Help with git

Mike McCormack mike at codeweavers.com
Tue Sep 12 20:33:48 CDT 2006


Matt Finnicum wrote:
> What I do is to follow along with things on the shortlog:
> http://source.winehq.org/git/?p=wine.git;a=shortlog
> 
> Lets say you want to move your current branch to my recent patch
> "riched20: Rewrite of scrolling and some redrawing code." - you'd
> click the link "commit" to the right of it. In the page that you'll be
> taken to, you'll see a line like this:
> commit    abecd9e393925e008449a80ec14682790b29042c
> 
> you can then do a "git reset --hard abecd9e393925e008449a80ec14682790b29042c"
> 
> and your git will be moved to the point in time right after that
> commit. If you then want to manually apply a patch, click "commitdiff"
> to the right of it's entry in the shortlog, followed by "plain" on the
> top - this will take you to a plaintext diff of the patch, which you
> could save to a file and apply with the patch command. ("patch -p1 <
> thepatch.diff" usualy works well for me)

There's easier ways to do the second bit.

1) Use git cherry-pick

    git branch master-20060913
    git reset --hard abecd9e393925e00
    #examine the log for commits
    git log master-20060913..abecd9e39392
    #pull in commits
    git cherry -r 112810a480aaee4d6d8
    git cherry -r aaca30cf039c227e
    #etc

2) Use git format-patch to get all the patches in the tree before
    resetting:

    # put them all in one file named mb
    git format-patch --stdout abecd9e39392 > mb

    # or create multiple files
    git format-patch abecd9e393925e008

    Then reset (remember to have a clean tree!)

    git reset --hard abecd9e393925e

    Then edit "mb" and "git am" the patches you want:

    git am mb

You don't need the full SHA1 ID... just enough to make it unique in the 
tree.

Mike




More information about the wine-devel mailing list