问题
I have forked a repository, but I'd like to keep it in sync with the upstream repository often. I have swapped some modules with my own implementation, so that means that every time I want to sync with the upstream repository, I keep getting the same merge conflicts over and over again.
My question is: Is there a way to tell Git to use my own implementation for these case, rather than marking it as merge conflict? Is there something that I can automatize here, so I don't run into the same issues over and over again?
Thanks.
回答1:
Use the rerere
machinery ("reuse recorded resolutions"):
git config rerere.enabled true
If the exact same conflict turns up again that has been resolved (and commited!) earlier, its resolution is applied again. By default, you still have to confirm the resolution, but it does the grunt work for you.
rerere
works only for content conflicts, not for add/modified or delete/modified conflicts.
来源:https://stackoverflow.com/questions/42179093/forked-repository-resolving-the-same-merge-conflicts-every-time-i-sync-with-up