Rya*_*son 17 git merge-conflict-resolution git-rerere
我正在使用git-rerere
它的预期目的,在这些分支开发时逐步记录两个分支(主分支和主题分支)之间的冲突解决方案,而不会创建不必要的合并提交.然而,即使在阅读了git-rerere manpage后,我还不清楚rerere何时实际记录了我的冲突解决方案.我检测和解决新合并冲突的标准工作流程是git merge master
从主题分支,解决冲突,然后暂存所有文件并提交合并git commit -m "Finished test merge"
,然后撤消合并使用git reset --hard HEAD^
,只留下存储的记录分辨率git-rerere
.
然而,这似乎有点傻.创建一个提交,然后撤消它只是为了记录分辨率?在阅读了联机帮助页后git-rerere
,我仍然不清楚它何时记录我的决议.仅仅暂存冲突的文件是否足够,或者在解决冲突后我是否真的需要创建合并提交,就像我一直在做的那样?
Dan*_*ich 12
从联机帮助页:
Running the git rerere command immediately after a conflicted automerge
records the conflicted working tree files, with the usual conflict
markers <<<<<<<, =======, and >>>>>>> in them. Later, after you are
done resolving the conflicts, running git rerere again will record the
resolved state of these files.
Run Code Online (Sandbox Code Playgroud)
和:
As a convenience measure, git merge automatically invokes git rerere
upon exiting with a failed automerge and git rerere records the hand
resolve when it is a new conflict, or reuses the earlier hand resolve
when it is not. git commit also invokes git rerere when committing a
merge result. What this means is that you do not have to do anything
special yourself (besides enabling the rerere.enabled config variable).
Run Code Online (Sandbox Code Playgroud)
因此,您不必提交和撤消提交.您可以在git rerere
没有参数的情况下运行来记录提交.