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 git rebase例子

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

  • 链接地址: http://www.djcxy.com/p/45118.html

    上一篇: 更新github上的分叉库

    下一篇: git pull是否总是创建一个合并提交?