Receiving updates with Git pull
In the last recipe, we learned how to set up a remote repository and send local changes to a remote using the git push
command. The story is not complete yet. When the repository is shared by multiple people, everyone will push their own changes. The central repository will keep on updating. When you want to synchronize or push your changes to the central repo, you need to download any updates made by other users and then push your modifications on top of that. A git pull command will be used to pull down any updates to the remote central repository to your local repository.
This recipe covers the git pull command. We will use this command to resolve a rejected push, but it is generally used simply to update your local copy.
Getting ready
You will need one central remote repository; it may be hosted on GitHub or anywhere else.
Secondly, you will need two local copies of the central repo. Use the git clone
command to create a local replica of the remote repository...