重新启动Git:在首次记录后记录新的冲突解决方法

时间:2018-09-18 18:27:31

标签: git commit amend git-rerere

由于解决冲突而合并或重新定位后,我使用该修复程序进行了第一次提交。

但是有时候,在完成合并/重新设置之后,我发现错误,因此我必须修改合并提交。我想记录一下这次修订后提交的新冲突解决方案。为了在变基的情况下有正确的冲突解决方案。

该怎么做?


以下是重现此问题的步骤:

git checkout master
git merge origin/ABranch
git commit -a # rerere record the conflict resolution

# change conflicts resolution in local
git commit -a --amend # rerere do not record new resolution of the conflicts

# New commit must be done on origin/master before this command
git rebase origin/master # need new commit on the master

这是我使用的典型工作流程,在初次提交后可以发现问题。

git checkout master
git checkout -b TestCompilationAndUTest/Merge2018.1ToMaster
git merge origin/Release/2018.1 # Merge the release branch of version 2018.1 on the master

# I fix the conflict and compile part of the code. 
# But it's difficult to run all tests locally
git add . # add files with conflict resolved
git commit # Create the merge commit. rerere will record the conflict resolution.
git push # Push on server in order to run all UnitTest and compilation on the build server

# If the build server found problem, I fix it locally.
git add . # Add fix for problem found by the build server
git commit --amend # I want to keep only one merged commit.
                   # Here the problem, rerere won't record the new resolution conflicts!

# Now, before pushing on the server, I have to retrieve the new modifications on the master
git fetch
git rebase origin/master # rerere reapply the resolution conflict for the first commit,
                         # without modification done during the --amend.

0 个答案:

没有答案
相关问题