问题
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?
回答1:
My workflow typically consist of:
Make changes -> test -> commit -> make more changes -> test -> commit -> repeat.
This gives me multiple local commits that together comprise what need to be done. When I feel done I run:
git rebase -i HEAD~[nr_of_commits_i_created]
And I make sure to fixup all but the first one. The first one I either keep as it is or reword it one last time. Now I end up with 1 commit containing all my changes. I rebase on my master branch, solve any conflicts and push my changes.
This way I never really have to deal with merging.
I realize that this does not directly answer your question.
回答2:
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.
来源:https://stackoverflow.com/questions/49548570/how-to-fixup-git-rerere-resolution