问题
Given this:
master A---B---G---H---I
\
branch C---D---E---F
Is there anyway to get to the following, but using -X theirs
only for the C commit?
master A---B---G---H---I
\
branch C'--D'--E'--F'
(I've created a branch for migrating a big solution from VS2008 to VS2010. The first commit on the branch was the one that changed all the project files. Now I would like to update the branch to get the latest changes, but without having to manually merge any conflicts arising from tool-generated code)
回答1:
You could try to:
- merge first
C
tomaster
, using one the the merge --strategy=theirs detailed in this SO answer. - then
git rebase master
(which shouldn't repeat commitC
, since it has already been merged and is identical to theC
ofbranch
).
回答2:
This obvious rebasing step, pulled straight from the manuals doesn't work?
git checkout branch
git rebase master
回答3:
guess, you can use cherry-pick to apply one commit anywhere you want:
git checkout master
git cherry-pick -x C
this will apply C patch to master. then you can rebase your branch on master, because it will contain C inside
git checkout master
git rebase master
来源:https://stackoverflow.com/questions/7632678/how-could-i-use-a-different-strategy-for-just-one-commit-in-a-rebase