2016-07-05 83 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

太好了 - 謝謝! –