pull是否总是创建一个合并提交

pull是否总是创建一个合并提交

本文介绍了git pull是否总是创建一个合并提交?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

git pull 总是创建一个合并提交?



如果我有一个功能分支,迄今与 git pull -r。 master ,然后切换到master并执行 git pull。 feature-branch 我不认为我得到了一个合并提交。

解决方案

你有一个



阅读下面的链接以了解不同的观点:







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.

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是否总是创建一个合并提交?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 20:05