Merging from staging to master

brett lentz wakko666 at gmail.com
Tue Sep 15 22:08:53 UTC 2009


On Tue, Sep 15, 2009 at 2:54 PM, Mike McGrath <mmcgrath at redhat.com> wrote:
> This has bugged me forever and I think I've got it figured out now (thanks
> mdomsch for pointing me in the right direction)
>
> Lets say you've been working for weeks on a module in staging and you want
> to cherry pick those commits.  How do you do it?  It becomes trickier even
> if someone else has been working on other modules in staging.  This seems
> to do the trick:
>
> git log --name-status master..staging module/path
>
> or to see the diff
>
> git diff master staging module/path
>
> The only thing to be careful of that I can tell is if one of the commits
> listed in git-log includes something in another path outside of your
> module.
>
> Anyway, if you can think of a better way to do this let me know, so far
> though this worked well for me.
>
>        -Mike
>


Depending on what you're looking for, this can be achieved a few
different ways.

If the goal is to copy the end-result (or, current state) between
branches, and maintaining commit history isn't as important, you can
just do this:

git diff --relative branch1 branch2 -- path/to/files | git-apply --index

or

git diff --relative branch1 branch2 -- path/to/files | patch -p1

If the goal is to cherry-pick every commit and replay them into a new
branch, then your above method is probably the best way to do it.

For reference, here's a good explanation from Linus on this issue:
http://thread.gmane.org/gmane.comp.version-control.git/37600/focus=37683

---Brett.




More information about the Fedora-infrastructure-list mailing list