git pull command example
git pull command
Git pull command is used to fetch the files from remote repository to local repo
If you want to push any commits you must be in synchronize with remote git repository.
Synchronize is nothing but whatever the files and commits in remote github repository must be in local repository.
Then only you can push commits to remote repo otherwise it will through you errors.
To synchronize local repository with remote github repository we use pull command.
git pull origin master
Here I pulled master branch , if you want to pull any other branch use this below command
git pull origin branchname
In the place of branchname write your branch.
what exactly does the git pull command
When you are executing pull command it will execute two commands in background.
first fetch and then merge
Fetch command will download all files from remote repo to local repo.
and
Fetch doesnot change local working copies or local files.
Merge command will merge the files , so finally you will get the files from remote repo to local repo.
If you want to know difference between git fetch and pull see this.
- difference between git fetch and pull