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
, and then I switch to master and do git pull . feature-branch
I don't think I get 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
, and then I switch to master and do 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.
(source: ofilabs.com)
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.
Read the link bellow to have an idea on differents point of view :