What does git pull origin master do?
The git pull
command is used in many variations (take a look at our git pull command overview to learn more). But one of the notations that developers find themselves typing most often is git pull origin master
: it downloads new changes from the branch named master
on the remote named origin
and integrates them into your local HEAD branch.
The Git Cheat Sheet
No need to remember all those commands and parameters: get our popular "Git Cheat Sheet" - for free!
Downloading & Integrating with git pull
Using git pull
(and git pull origin master
is no exception) will not only download new changes from the remote repository. It will also directly integrate them into your local HEAD branch. By default, this integration will happen through a "merge", but you can also choose a "rebase":
$ git pull origin master --rebase
If you don't want to integrate new changes directly, then you can instead use git fetch
: this will only download new changes, but leave your HEAD branch and working copy files untouched.
$ git fetch origin
Using the Plain git pull Command
In most cases, your local HEAD branch will already have a proper tracking connection set up with a remote branch. This configuration provides default values so that the pull command already knows where to pull from without any additional options. This means that, if a tracking connection has been set up, you can simply omit naming the remote repository and branch:
$ git pull
You can learn more about tracking connections in our free online book.
Tip
Easy Pull & Push in Tower
In case you are using the Tower Git client, pulling from a remote is very easy: simply drag the remote branch and drop it onto your current HEAD in the sidebar - or click the "Pull" button in the toolbar.
Just like pulling, many other Git commands can also be executed with a simple drag-and-drop operation in Tower.
Learn More
- Check out the chapter Inspecting Remote Data in our free online book
- More frequently asked questions about Git & version control