Git Push Command | Git Bash Tutorial | Git Commands | Git Tutorial For Beginners | Simplilearn

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey everyone my name is ashan and i welcome you all to this session before we begin let's have a look at all the topics we will be covering today we will begin with learning the basics of kit then we will check what is github followed by different commands that we use in gate then we will start with git push and in the end we will have a look at the demo of the push command there we will learn how to push a file or a folder from the local repository to the remote repository so without any further ado let's get started with what is git git is the most commonly used version control system that helps in tracking changes made to a file hence we may have a record of all the changes that have been made in a file and we can also revert back to a specific version git helps in the process of collaboration and permits changes made by multiple people to be merged into a single source there may be one branch where the work is being done and the changes are made in that file on that branch so now when we need to collaborate we may upload our changes to the centrally located branch now when there's another branch and different set of work is being processed on it and we need to make it accessible to all the users we must push that work onto the main branch git automatically merges the changes so two people or two different sources can even work on different parts of the same file and later merge those changes without losing each other's work now when we know what is git let's have a look at what is github github is a service hosted on the web where all the projects are stored every project on github has its own repository and its unique url git provides a graphical interface to store the files and helps team members to coordinate on the project from anywhere github provides several access control collaboration features like wikis and basic task management tools for every project now when we are all aware of git and github let's have a look at some prominent commands used in git first command is the git config command this command helps in configuring values on a global or a local project level it helps in configuring the user name and the email address second command is the git init command it is used to initialize a repository whenever we run this command a folder by name dot get gets created in the folder and from that time git will start tracking any changes made to that folder it also creates a new repository and a branch and that branch is created by a default name called a master branch third command is the git add command it is used for adding any number of files to the git repository it could be one file two file or an entire folder all of them could be added to the repository using this command then we have a git diff command which helps in finding and viewing the changes made to the file between the commits fifth command we have is the git commit command this helps in committing all the work we have done in terms of files we have got in terms of changes we have made and everything will be committed with this single command next command is the git reset command this command helps in undoing the local changes made to the state of a git repo then we have the git status command this command helps in having the status of all the files the files that got deleted or created or got modified the status of all such files can be obtained with the help of git status command next command is the git merge command this command helps in joining two or more development histories or branches together into an active branch moving forth we have the git push command this command is used to push the contents from the local repository to the server last and the tenth command we will see is the git pull command this command is used to fetch and download content from the remote repository and update them to the local repository today we will be learning about git push command in detail and then we will have a look at how is that get push command used in git so now let's get started with what is git push here we can see a project in the system this project is being added to the local repository where it is being committed then this project after being committed is to be sent on the remote repository so for that we use the push command pushing is an act of transferring commits from our local repository to a remote repository now in case we ever want to access any project from the remote repository on our system we will use the pull command so let's move further to have a look at the git push command in detail get push command may be considered as a tool to transfer commits from the local to the remote repository when we use the push command and do not put any specific location then the files or the project will be by default push to the origin master if there are any modifications made in the local repository then a push command is executed to move those modifications to the remote repository so that they can be shared with all the team members now when we know about git push let's have a look at the demo where we will push files and a folder to the git repository so now for the demo we will begin with opening our git bash in the git bash we will start with configuring our name and email id for a name i'll type git config global user dot name the name i'm using is simply learn github now for the email id what i'll do is i'll again use the same statement with user.email and in the case of email id we do not need these double quotes so the email id i'm using is siddham dot bharath at simplylearn.net now let's check if the configurations were set correctly or not for this we'll check git config list in the list we can check here that we have our name user.name and user.email so we have as it is we had set it so moving on now let's check the address of our remote directory by default we are always placed into our home directory now we will create a folder in this directory from where we will create all our git repositories i will create a folder with the name git underscore demo so now we will again check the location the folder is empty as of now we can navigate to this folder and check this is our folder we can check this is empty so now so now let's create a first repository our first repository we will create with the name of first repo now let's again go back to that folder and check so we can check we have this first repo now this folder is empty let me create a repository for this folder how do we do that we do that with the help of git init command this means a repository has been initialized now when we go back to this folder we can find a hidden file created this folder is created with the name of dot git i can see that folder because i've enabled the settings of viewing hidden files if we get into the folder we see a bunch of directories and configurations make sure you don't make changes to any of the directory now we can see something called as a master appears on the screen whenever a git repository is created for the first time it creates a branch the name of the branch by default is the master and that is why we see this master on the screen now let's create a few files for a folder we will use the touch command for it let's create the file with the name alpha when we type this notepad command we can see a notepad appears on the screen i will type beta gamma inside this notepad save it and close it now let's check the status of this file now it shows that no file is yet committed we can see the untracked file in red color now what we need to do is add these files we can add these files with the specific name or we can simply write git add space dot now when we again check the status now when we run the git status command we can see there are no commits yet and the files that were earlier in red color have now become green it also shows a remove command in case we want to unstage or undo the changes now we can go on and commit this file for commit we will type git commit space dash m and in double quotes we'll type beta gamma now we can see one file changed and one insertion made so when we move further let's have a look at the logs of all the files for logs we'll type git log here we can see the commit id of the file that we had created now let's make one more commit we will do the same process again we will again type the touch command this time we'll keep the file name as beta then we'll again type the notepad command this time in the notepad we'll type alpha and gamma again we'll save it and close it let's make some changes in the previous notepad file we had so for that we'll again type notepad alpha.txt this time let's add beta gamma and delta we again saved it and closed that file let's now check the status of all the files we'll type git status command we can see it shows that alpha.txt has been modified and beta dot txt is still untracked we again need to add these files so for adding we'll again type git add space dot now let's commit these files for commit we will enter the text the text was alpha space gamma we can see two files changed two insertions made and one deletion now when we have all the changes and the files with us we may want to share these files with someone else and work in a collaborative way so for that we will push the repository to a git server here i have my git account logged in so i'll go here make a new repository as the new repository i'll keep the name as first repo then the description is optional so we will just create the repository now when a repository is created we will copy this git remote add origin command go back to our git bash and simply paste it here so now for git push we first need to execute the get remote command now let's push our files to the get repository for that we will use git push space dash hue origin master we can see there are things that have been pushed let's go back to our github and check let's open our repository and see if the files that we wanted have been pushed here we can see all our two files have been pushed let's check the content for it alpha.txt it has got beta gamma and delta as we have saved and beta.txt we have alpha and gamma as we have saved now let's also see how we can push a folder we will make a folder let's make a folder with the name git demo in the git demo folder we will put our git presentation and let's put the git pdf also now we will copy this folder and take it to our directory in our directory we will paste the folder here then we will go back to our git bash add this and now let's commit this folder for commit we will type git commit space dash m and let's write add folder as we can see two files changed zero insertions made and zero deletions so that means it's time for us to push this file now we will again push with the same command now we can see there are things that have been pushed let's go back to our github and check so let's refresh it here we can see our folder with git demo has come let's open this folder and now let's try to download this pdf we can see this is opening here and now when we are trying to download we can see the entire pdf of our presentation here so with this we have come to the end of our video i hope you guys found it informative and helpful thanks for watching and stay tuned for more from simply learn hi there if you like this video subscribe to the simply learn youtube channel and click here to watch similar videos turn it up and get certified click here
Info
Channel: Simplilearn
Views: 138,780
Rating: undefined out of 5
Keywords: git push, git push command, git bash tutorial, git commands, git bash tutorial for beginners, git push request, git push to github, how to use git push command, how to use git push, how to use git bash to push to github, git bash commands, what is git push, git push command example, git bash commands windows, git tutorial, git tutorial for beginners, git basics, git basics tutorial, git basics for beginners, devops tools, simplilearn git, simplilearn
Id: QJ0iUNe27c8
Channel Id: undefined
Length: 15min 30sec (930 seconds)
Published: Wed Mar 04 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.