git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: kernel cherry UN-picking?

From
Junio C Hamano <junkio@cox.net>
Date
May 11, 2007, 22:09 UTC
Message-ID
<7vbqgr9fn9.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<7vhcqj9g8r.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano <junkio@cox.net> writes:
Show 20 quoted lines
> Jeff Garzik <jeff@garzik.org> writes:
>
>> So, I merge the next batch of net driver patches.  After I merge a PPP
>> patch, deep in the pile-o-patches, Andrew says "I shouldn't have sent
>> that to you, don't apply it"  ;-)
>>
>> Right now, my process for reversing this damage is to start over:
>> create a new branch, manually double-click the mouse on each commit in
>> the "damaged" branch, and git-cherrypick it.  Very, very time
>> consuming when you have more than a couple commits.
>
> Do the commits on the branch being rebuilt form a single strand
> of pearls without any merges?  If that is the case, what I would
> do is:
>
> 	git heckout thatbranch
> 	git format-patch -o ./+outdir linus
>         rm ./+outdir/0XXX-that-unwanted-patch.patch
>         git reset --hard linus
>         git am ./+outdir/????-*.patch

Ok, you answered that your branch involves a merge from Linville tree.

You would need to segment things then.

Suppose you have something like this (you may have more than one such merge but the principle is the same):

  U---o---o---o---M---x---o---o---o---T
                 /
   Linville o---o

Up to 'U' you have already sent upstream and no need for resending. 'M' is merge with Linville tree. 'x' is the bad one, and 'o' are good ones. 'T' is the tip of your net driver branch.

First find out 'x'.  Then
        git format-patch -o ./outdir x..T

would format everything starting from (but excluding) 'x' up to 'T'.

Then
        git reset --hard x^
        git am ./outdir/*.patch
would rebuild:
  U---o---o---o---M---x---o'--o'--o'--T'
                 /
   Linville o---o

A variant that needs "segmenting" is if the bad one is before the merge, like this:

  U---o---x---b---M---o---o---o---o---T
                 /
   Linville o---a

First you need to note 'a' (tip of Linville you pulled) and 'b' (tip of you before you pulled from Linville). Then:

        git format-patch -o ./outdir-1 x..b
        git format-patch -o ./outdir-2 M..T
        git reset --hard x^
        git am ./outdir-1/*.patch
would give you this:
  U---o-------b'
                 
   Linville o---a

and leave you at b (rebased not to contain the bad one). Then you redo the Linville merge:

  U---o-------b'--M'
                 /
   Linville o---a
And finally apply the rest:
        git am ./outdir-2/*.patch
to arrive at:
  U---o-------b'--M'--o'--o'--o'--o'--T'
                 /
   Linville o---a
Previous: Junio C HamanoNext: Junio C Hamano
Message 6 of 9 in “kernel cherry UN-picking?”
  1. Jeff GarzikMay 11, 2007
  2. Andrew MortonMay 11, 2007
  3. Jeff GarzikMay 11, 2007
  4. Josef SipekMay 15, 2007
  5. Junio C HamanoMay 11, 2007
  6. Junio C HamanoMay 11, 2007
  7. Junio C HamanoMay 11, 2007
  8. Jan HarkesMay 12, 2007
  9. Jan HarkesMay 12, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.