2014-09-30 321 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