HOWTO: Bringing in lots of correctly cherry-picked patches

Andrew Bartlett abartlet at samba.org
Fri Jan 25 04:04:45 MST 2013


We like to have patches in v4-0-test be marked as cherry-picked from
master, so we know where they came from for context.

I like using gitk to pick out my changes, as it helps me find and review
changes.  However, it can't cherry-pick with -x, which we need.  There
is no way to make -x the default again (it once was).

So, what I did was (from memory, but written down in case it helps
someone else, or for me to find later):

git cherry-pick --abort
git rebase --abort
git clean -x -f -d
git checkout origin/master -b to-cherrypick-for-4.0

used gitk to reset to samba-4.0.0rc1
git reset --hard samba-4.0.0rc1
git cherry-pick HEAD..origin/master
(wait a very long time, disk murdered by fsync)

git checkout -b v4-0-build-fixes
git rebase -i origin/v4-0-test

This lets me select patches easily, in order, skipping some if required.
In particular, if a patch fails 'git rebase --skip' works, while if you
did the same with a range cherry-pick, you can't --skip.  Likewise, it
is smart about patches already in the tree, not even showing them in the
rebase -i window.  You can also easily edit for conflicts in the usual
rebase way.

git format-patch origin/v4-0-test..HEAD --stdout > build-fixes-4-0.patch

Then I upload these into bugzilla.  The resulting commits have the
cherry-pick markers we need, because to the rebase these are just commit
text, and so are not altered.

Andrew Bartlett

-- 
Andrew Bartlett                                http://samba.org/~abartlet/
Authentication Developer, Samba Team           http://samba.org




More information about the samba-technical mailing list