How to “fixup” git rerere resolution

时光毁灭记忆、已成空白 提交于 2019-12-11 18:17:28

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!