Reputation: 9865
What is the difference between:
git checkout -b <branch> origin/<branch>
and
git pull origin <branch>
They seem to have the same functionality to me. thanks.
Upvotes: 12
Views: 14825
Reputation: 311377
git pull
contacts the remote repository identified by origin
and looks for updates. It fetches any updates and then merges the changes into the target branch. It does not create a new branch.
git checkout -b <branch> origin/<branch>
creates a new branch based on origin/<branch>
, and does not contact the remote repository. It looks at origin/<branch>
as it currently exists in your local repository.
The two commands perform very different actions; spending some quality time with the git-pull
and git-checkout
man pages might help clarify things.
Upvotes: 18