Git rebase 因冲突而失败,但没有冲突

标签 git rebase tortoisegit merge-conflict-resolution

我尝试对我已提交但未推送的代码进行 rebase,因为我听说 origin 中有一些更改可能会影响我正在处理的内容。这是我得到的:

$ git rebase origin/thor-develop
First, rewinding head to replay your work on top of it...
Applying: PH-2127: F193: SYO for Signed in User
Using index info to reconstruct a base tree...
M       js/angular/localization/StoreListCtrl.js
M       templates/default_site/site_embed.group/html_header.html
<stdin>:17: trailing whitespace.

<stdin>:73: trailing whitespace.

<stdin>:77: trailing whitespace.

<stdin>:78: trailing whitespace.
                            $scope.address_dropdown = addressStore.getTop($scope.my_occasion, 3);
<stdin>:79: trailing whitespace.

warning: squelched 16 whitespace errors
warning: 21 lines add whitespace errors.
Falling back to patching base and 3-way merge...
Auto-merging templates/default_site/site_embed.group/html_header.html
Auto-merging js/angular/localization/StoreListCtrl.js
CONFLICT (content): Merge conflict in js/angular/localization/StoreListCtrl.js
Failed to merge in the changes.
Patch failed at 0001 PH-2127: F193: SYO for Signed in User

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".

我们使用 Tortoise Git 作为前端编辑器,所以我进入了 Resolve 工具。它通常显示差异,这当然是可以的,而冲突则不是。它显示我在引用的文件 (StoreListCtrl.js) 中绝对没有冲突。有明显的差异,但完全没有冲突。这是什么意思,我该如何修复它才能完成 rebase 并最终 merge 我的代码?

最佳答案

解决工具可能会自动为您修复冲突。以前发生在我身上(并且让我感到困惑)。在这种情况下,您可以直接转到 git rebase --continue .

完整的 list 是:

  • 如果git status显示任何未暂存的更改:
    • 如果这些文件有 V 形符号 <<< >>>标记冲突:
      • 修复冲突并保存文件
    • 现在使用 git add 暂存所有未暂存的更改: 这标志着冲突已解决
  • 现在所有冲突都已解决并标记:使用 git rebase --continue

关于Git rebase 因冲突而失败,但没有冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22486880/

相关文章:

git - 如何将 Git 与多个远程存储库一起使用?

git - 如何复制一个 git 仓库? (没有 fork )

git - 使用 GitLab 页面托管静态网站

git - rebasing 分支,有自己的分支

git - Windows 上的 git 数据库文件存储在哪里?

git - TortoiseGit: "Git Sync"、 "Fetch"和 "Pull"之间有什么区别?

git merge 裸仓库中的分支

推送被拒绝后 git rebase 修复

git - 防止 Master Branch 领先于 dev

git - 从 git 存储列表 merge 时,如何删除或清理 merge 到目标分支的孤立 "untracked file"提交分支?