2016-07-05 81 views
0

我使用GitKraken来查看我的工作树,并学习如何git分支和合并。Git合并日志不同

场景:我有一个工作大师,但必须执行错误修正。

git branch Hotfix #Create a new branch for the hotfix 
git checkout Hotfix #Move to Hotfix branch 
git commit NowGoodFile.cs -m "Add test tools" #Make changes 
git checkout master #Checkout master 
git merge Hotfix #Merge Hotfix into the master 

一步的,我想什么步骤发生:

  • 我有一个主 - 工作,却发现了一个错误:

enter image description here

  • 我创建分支,Hotfix,进行我的更改:

enter image description here

  • 我然后合并这些变化到主:

enter image description here

但这不是我做git merge Hotfix会发生什么。我得到这个:

enter image description here

我应该怎么写merge into影响?

回答

2

默认情况下git merge使一个快进合并时有可能。你期望的是true merge,可以通过--no-ffmerge.ff设置为false来完成。

+0

我想要快进吗?根据[Atlassian的(https://www.atlassian.com/git/tutorials/using-branches/git-merge): > ...许多开发人员喜欢使用快进...并轨小的特性或错误修复,同时保留3路合并以集成更长时间运行的功能。 –

+0

@RasmusBækgaard它取决于。我个人更喜欢快进合并,并且总是试图为发布分支创建线性历史记录。 – ElpieKay

+0

太好了 - 谢谢! –