Search code examples
gitgit-rerere

How to "fixup" git rerere resolution


My workflow usually consists of merge -> resolve conflicts -> commit -> debug during compilation -> fixup commit. In this way I make dirty merge with clearing afterwards. If I enable rerere I would always have dirty resolutions recorded. How to bypass this problem? Is there a way to fix rerere resolution by following commit?


Solution

  • It is clumsy but what have I did for my last big bad merge.

    At first I have checkout my branch to before merge state in tmp branch. Then run similar merge. Then do following process:

    for F in `git show $FIXCOMMIT --stat | awk '{print $1}' | tail -n +7 | head -n -1`; do
        git checkout -m $F
        git rerere forget $F
        cp $FIXED/$F ./$F
    done
    

    Where FIXCOMMIT is commit with fixes. And FIXED is workingtree with FIXCOMMIT state.

    As a lesson I think that one shouldn't commit merge before compilation.