修复冲突后git还在抱怨吗?

JP *_*shy 32 git

我通常rebase在从队友那里获得变化时,经常是我有冲突的时候:

...
CONFLICT (content): Merge conflict in app/views/search/index.html.erb
Auto-merging public/stylesheets/application.css
CONFLICT (content): Merge conflict in public/stylesheets/application.css
Failed to merge in the changes.
Patch failed at 0001 organizing

When you have resolved this problem run "git rebase --continue".
If you would prefer to skip this patch, instead run "git rebase --skip".
To restore the original branch and stop rebasing run "git rebase --abort".
Run Code Online (Sandbox Code Playgroud)

因此,在打开每个冲突文件后,修复它然后提交固定文件:

~/Projects/myApp[956f6e1...]% git rebase --continue
You must edit all merge conflicts and then
mark them as resolved using git add
Run Code Online (Sandbox Code Playgroud)

我仍然得到同样的错误......

~/Projects/myApp[64b3779...]% git rebase --continue                         
Applying: organizing
No changes - did you forget to use 'git add'?

When you have resolved this problem run "git rebase --continue".
If you would prefer to skip this patch, instead run "git rebase --skip".
To restore the original branch and stop rebasing run "git rebase --abort".
Run Code Online (Sandbox Code Playgroud)

我总是有这个问题,但我想从来没有真正选择解决它,我会一直懒得和git rebase --skip.

我如何以正确的方式实际解决冲突?

Mar*_*off 37

因此,在打开每个冲突文件后,修复它然后提交固定文件...

问题是你不应该commit修复.如果a.txt有合并冲突,那么您的shell日志应如下所示:

$ vim a.txt # fix conflict
$ git add a.txt
$ # no commit between add and rebase!
$ git rebase --continue
Run Code Online (Sandbox Code Playgroud)

调用git rebase --continue将负责提交本身.

我不确定如何在你提交之前"回头",当你处于一个变种的中间时. git reset --hard HEAD可能会做的伎俩,但就个人而言,我觉得更安全,只是直接进入git rebase --abort并重新开始,而不是在中间进行.