1

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)

mmmmmm
  • 32,227
  • 27
  • 88
  • 117
Benjol
  • 63,995
  • 54
  • 186
  • 268

3 Answers3

2

This obvious rebasing step, pulled straight from the manuals doesn't work?

git checkout branch
git rebase master
lprsd
  • 84,407
  • 47
  • 135
  • 168
  • No, because I'm looking to use a specific strategy on **just one commit** (admittedly, this may not even be logically possible, I'm not sure). – Benjol Oct 03 '11 at 09:42
  • If you want one specific commit (unlike your image that moves all commits after that) you should really cherrypick that one here. – lprsd Oct 03 '11 at 10:14
2

You could try to:

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • @Benjol: which strategy did you use for the first merge? – VonC Oct 03 '11 at 12:22
  • `merge ours` to tmp branch, then ffw merge back the other way. TBH, in the intervening period I also found an alternative (SmartGit lets you block-resolve a group of conflicts, choosing ours/theirs). – Benjol Oct 03 '11 at 12:36
2

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
radistao
  • 14,889
  • 11
  • 66
  • 92
  • Yes (+1), this is similar to the method to avoid having a commit repeated twice in the history due to a cherry-pick: http://stackoverflow.com/questions/2627953/git-cherry-pick-and-datamodel-integrity/2628915#2628915 – VonC Oct 03 '11 at 15:44
  • @radistao, so does cherry-pick automatically have 'theirs' semantics in this case? – Benjol Oct 04 '11 at 04:39