簡體   English   中英

Git rebase 合並沖突無法繼續

[英]Git rebase merge conflict cannot continue

我正在嘗試重新設置“dev”以趕上“master”分支。

$ git checkout dev 
$ git rebase master 
First, rewinding head to replay your work on top of it...
Applying: Corrected compilation problems that came from conversion from SVN.
Using index info to reconstruct a base tree...
M       src/com/....
<stdin>:125: trailing whitespace.
/**
<stdin>:126: trailing whitespace.
 *
<stdin>:127: trailing whitespace.
 */
<stdin>:128: trailing whitespace.
package com....
<stdin>:129: trailing whitespace.

warning: squelched 117 whitespace errors
warning: 122 lines add whitespace errors.
Falling back to patching base and 3-way merge...
Auto-merging src/com/....
CONFLICT (content): Merge conflict in src/com/...
Failed to merge in the changes.
Patch failed at 0001 Corrected compilation problems that came from conversion from SVN.

When you have resolved this problem run "git rebase --continue".
If you would prefer to skip this patch, instead run "git rebase --skip".
To check out the original branch and stop rebasing run "git rebase --abort".

$ vi src/com/.....   { fixed the merge issue on one file } 
$ git add -A . 
$ git rebase --continue 
src/com/....: needs merge
You must edit all merge conflicts and then
mark them as resolved using git add
$ vi src/com....      { verified, no >>> or <<< left, no merge markers } 
$ git rebase --continue 
Applying: Corrected compilation problems that came from conversion from SVN.
No changes - did you forget to use 'git add'?
If there is nothing left to stage, chances are that something else
already introduced the same changes; you might want to skip this patch.

When you have resolved this problem run "git rebase --continue".
If you would prefer to skip this patch, instead run "git rebase --skip".
To check out the original branch and stop rebasing run "git rebase --abort".

有任何想法嗎?

有幾種情況我見過rebase卡住了。 一種是如果更改為空(提交具有先前已在 rebase 中進行的更改),在這種情況下,您可能必須使用git rebase --skip

這很容易說出來。 如果你做git status它應該不會顯示任何變化。 如果是這樣就跳過它。 如果不是這種情況,請發布一份git status的副本,我可以嘗試進一步提供幫助。

我遇到這個問題的時間之一是在git add之后執行git commit 因此,以下序列將產生您提到的變基錯誤:

git add <file with conflict>
git commit -m "<some message>"
git rebase --continue

同時,下面的序列運行沒有任何錯誤,並繼續變基:
git add <file with conflict>
git rebase --continue

帶有“全部”選項的git add -A可能會造成類似的情況。 (請注意,我對 git 非常缺乏經驗,所以這個答案可能不正確。)為了安全起見, git rebase --skip在這種情況下似乎也能很好地工作。

注意:Git 2.0.2(2014 年 7 月)修復了一種情況,即git rebase --skip會卡住並且無法繼續使用當前的 rebase。
請參閱brian m 的提交 95104c7 卡爾森 ( bk2204 )

rebase--merge : 修復--skip連續兩個沖突

如果git rebase --merge遇到沖突,如果下一次提交也發生沖突,則--skip將不起作用
msgnum文件永遠不會用新的補丁號更新,因此實際上不會跳過任何補丁,從而導致不可避免的循環。

更新msgnum文件的值作為msgnum中的第一件事。
這也避免了在跳過提交時出現“ Already applied ”消息。
調用 call_merge 的其他上下文沒有明顯變化,因為在這些情況下 msgnum 文件的值保持不變。

$ vi src/com....      { verified, no >>> or <<< left, no merge markers } 
$ git rebase --continue 

看起來您忘記了git add您的更改...

在經歷了很多沖突(長git status )的 rebase 之后,我無法弄清楚我應該上演的是什么。 我使用與 PhpStorm 集成的 Git,它沒有顯示任何未暫存的文件。

git add . 沒有解決它,但此評論建議調用git diff-files --ignore-submodules 這顯示了我必須專門 git add 的三個文件,這就是竅門。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM