2014-09-30 318 views
3

我重新綁定另一個分支到我的結帳分支,並在rebase期間發生衝突。我解決了合併衝突。在Git rebase期間解決合併衝突後需要提交嗎?

$ git status 
rebase in progress; onto 77c951b 
You are currently rebasing branch 'test' on '77c951b'. 
    (all conflicts fixed: run "git rebase --continue") 

Changes to be committed: 
    (use "git reset HEAD <file>..." to unstage) 

     modified: br_boss_buha_faktura/forms/br_boss_buha_faktura_head_dtl.frm 
     modified: br_boss_buha_faktura/valuelists/br_boss_buha_faktura_client.val 
     new file: br_boss_buha_faktura/valuelists/br_boss_buha_faktura_client_name.val 

Changes not staged for commit: 
    (use "git add <file>..." to update what will be committed) 
    (use "git checkout -- <file>..." to discard changes in working directory) 

     modified: br_boss_buha_faktura/valuelists/br_boss_buha_faktura_client.val 

我需要提交上述解決合併衝突git commit或者我直接走的更遠使用git rebase --continue

回答

0

做一個git rebase --continue將重寫你正在應用到你改變它的表單的當前提交。它將以您在test分支中使用的相同名稱進行更改。

請注意,您正在承諾提交,可能是分離的HEAD狀態!通常,在masterstaging分支上有一筆重債。

+0

所以我不需要使用'git commit'?我修復它,然後我只使用'git rebase --continue'? 「通常情況下,在主人或分期分支上有一次重逢」,你是什麼意思?我在分支'test'上,並在'test'分支上做了'git rebase featureA'。 – 2014-09-30 07:43:40

+0

是的,就像[文檔告訴你](http://git-scm.com/docs/git-rebase)。另外,正如@pala所說,你有一個文件沒有被分階段提交。這是意圖還是應該成爲目前rebase提交的一部分? – rubenvb 2014-09-30 08:58:17

+0

是的,我想,我必須添加'git add br_boss_buha_faktura/valuelists/br_boss_buha_faktura_client.val'文件,因爲'git rebase --continue'不起作用,並且我收到消息'您必須編輯所有合併衝突和那麼使用git add'將 標記爲已解決。 – 2014-09-30 09:29:51

4

在這裏,我看到

Changes not staged for commit: 
    (use "git add <file>..." to update what will be committed) 
    (use "git checkout -- <file>..." to discard changes in working directory) 

     modified: br_boss_buha_faktura/valuelists/br_boss_buha_faktura_client.val 

請不要

git add br_boss_buha_faktura/valuelists/br_boss_buha_faktura_client.val 

然後

git rebase --continue 
+1

'git add'之後,是否真的需要'git commit -a'? – 2014-09-30 08:05:20

+0

是的,請做git commit -a – Gopi 2014-09-30 08:20:44

+0

請你解釋一下,爲什麼我需要做一個提交,因爲我找到了一個[線程,這解釋了相反的情況](http://stackoverflow.com/a/3611293/183704) ? – 2014-09-30 08:34:05

0

一些很好的答案在這裏,但回答的問題。 你不需要需要在解決合併衝突後提交。

一旦你通過git add <file>一個git rebase --continue添加的分辨率到GIT臨時區域將做出承諾你使用原來提交信息了。

注意提交散列將改變!所以,當你將它合併到另一個提交了你在分支中修改的分支時,你將會遇到問題,將這些分支合併在一起。


注意我說你不需要git commit解析git rebase衝突後,但你可以如果要。

如果它更有意義,將文件從一個提交分割成一系列單獨的提交可能會很有用。通常你只是想解決衝突。如這裏所示:Break a previous commit into multiple commits