gpt4 book ai didi

解决 merge 冲突后 Git rebase 卡住了

转载 作者:太空狗 更新时间:2023-10-29 13:19:22 49 4
gpt4 key购买 nike

我正在运行一个遇到冲突的 rebase :

$ git rebase master
First, rewinding head to replay your work on top of it...
Applying: Better `SelectMotifsView.js`
Using index info to reconstruct a base tree...
M browser/AddLinkView.js
M browser/SelectMotifsView.js
M browser/index.html
Falling back to patching base and 3-way merge...
Auto-merging browser/index.html
CONFLICT (content): Merge conflict in browser/index.html
Failed to merge in the changes.
Patch failed at 0001 Better `SelectMotifsView.js`
The copy of the patch that failed is found in:
/Users/dmitry/dev/links/.git/rebase-apply/patch

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

没什么大不了的——我做了一个我知道会引起冲突的小改动:

diff --cc browser/index.html
index ba9c4f3,4c2a1c2..0000000
--- a/browser/index.html
+++ b/browser/index.html
@@@ -40,6 -40,7 +40,10 @@@
<label>
<%= label %>
<select class="form-control" name="motif">
++<<<<<<< HEAD
++=======
+ <% console.log(exclude); %>
++>>>>>>> Better `SelectMotifsView.js`
<% motifs.each(function(motif) { if (!exclude || exclude.indexOf(motif) < 0) { %>
<option value="<%= motif.get('id') %>"><%= motif.get('name') %></option>
<% } }); %>

我想保留 HEAD 的版本,它是空的,所以我进去并删除整个版本:

++<<<<<<< HEAD
++=======
+ <% console.log(exclude); %>
++>>>>>>> Better `SelectMotifsView.js`

我保存文件,browser/index.html,然后git add browser/index.html:

$ git add browser/index.html
$ git rebase --continue

然后:

Applying: Better `SelectMotifsView.js`
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 prefer to skip this patch, run "git rebase --skip" instead.
To check out the original branch and stop rebasing, run "git rebase --abort".

以前从未见过... git status 显示没有剩余的未解析路径。该怎么办?我读到其他相关问题,这可能是 --skip 的一个很好的用途,但这似乎不是空提交。还是我错了?

最佳答案

看起来补丁是空的,所以你可以按照 git 的建议安全地跳过它:

$ git rebase --skip

关于解决 merge 冲突后 Git rebase 卡住了,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21833300/

49 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com