2016-03-01 93 views
0

我在試圖瞭解git rebase如何處理合並。我認爲,通過-p,它可以重新定位已經解決的衝突合併。但它接縫不像。爲什麼我會與`git rebase -p`發生衝突

這裏是爲了說明問題的例子:

git init 
touch a && git add . && git commit -m 'first commit' 
git branch b 
git branch c 
echo 'a' >> a && git add . && git commit -m a 

git checkout b 
echo 'b' >> a && git add . && git commit -m b 

git checkout master 
git merge b 
echo ab > a 
git add . 
git commit 

git checkout c 
touch c && git add . && git commit -m c 

git checkout master 
git rebase -p c 

在這裏,我遇到衝突應用合併提交。 有人可以向我解釋爲什麼?

回答

1

不,-p只是在歷史中保持合併提交而不是將它們展平。該文檔明確地說,這不符合手動合併幫助:

(從the man page

合併衝突解決或手動修改合併提交不會保留。

+0

Oups我錯過了。有什麼解決方法嗎? –

+0

沒有什麼非互動的,我可以想到。也許你可以自己製作差異並重新應用它們? –

+0

謝謝,只是發佈了另一個問題,以瞭解爲什麼它的行爲如下所示:http://stackoverflow.com/questions/35714919/why-git-rebase-p-does-not-preserve-conflict-resolutions –