Does git pull always create a merge commit?
Does git pull
always create a merge commit?
If I have a feature branch that I bring up to date with git pull -r . master
git pull -r . master
, and then I switch to master and do git pull . feature-branch
git pull . feature-branch
I don't think I get a merge commit.
You have a good example about git merge and fast-forward on the linked website.
@MicroVirus gave a nice explanation. Below, the grey point is the HEAD of your local HEAD before the pull (fetch + merge). You can see the difference between the two way to merge.
git fast forward http://ariya.ofilabs.com/wp-content/uploads/2013/09/merging.png
Another way to update your repo with git pull
is to use --rebase
option. This option apply your commits on the top of the pulled branch rewriting the history. You can read details there. People are divided between using git pull
or git pull --rebase
. To my mind, the rebase should be use for bug fix instead classic pull should be use when a new feature is merged to master.
Git rebase example
Read the link bellow to have an idea on differents point of view :
git pull VS git fetch + git rebase
Difference between git pull and git pull --rebase
上一篇: 更新github上的分叉库