Git rerere: записать новое разрешение конфликта после первой записи - PullRequest
0 голосов
/ 18 сентября 2018

После слияния или перебазирования с конфликтами разрешения я делаю первый коммит с исправлением.

Но иногда я обнаруживаю ошибку после завершения слияния / перебазирования, и мне приходится вносить изменения в коммит слияния.И я хотел бы записать новое разрешение конфликта в этом исправленном коммите с уважением.Чтобы иметь правильное разрешение конфликта в случае ребазинга.

Как это сделать?


Вот шаг для воспроизведения проблемы:

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