Question

I have a local branch, which is topic, this branch is labelled on the latest local commit, for example commit version 3, I stay on topic branch, not master branch, then I do the git pull, there are other two commits(version 4 and version 5) showed up and the topic is moved to the latest commits, is it right? Should I stay at branch master and do the git pull? What is the difference?

Was it helpful?

Solution

As the man pages says:

git-pull - Fetch from and merge with another repository or a local branch

So, basically git pull is a shortcut for git fetch followed by git merge. That's why it will move your branch reference to the latest commit. If you were on master then master would be updated.

If you don't want your branches to be updated, just use git fetch instead.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top