On Thu, Jul 26, 2018 at 10:33:27AM -0700, Junio C Hamano wrote:
> Jeff King <[email protected]> writes:
>
> > So here's a replacement for just patch 1 (I'm assuming this creates less
> > work than re-posting them all, but it may not be if Junio prefers
> > dealing with a whole new mbox rather than a "rebase -i", "reset --hard
> > HEAD^", "git am" -- let me know if you'd prefer it the other way).
>
> A single patch replacement that is clearly marked which one to
> replace and which other ones to keep, like you did here, is fine.
> The amount of work is about the same either way.
>
> 0) I would first do these to make sure that I can replace:
> [..]
Thanks. As always, I find it interesting to see your workflows.
> 1-b) With a single patch replacement, it is quite different.
>
> $ git checkout HEAD~4 ;# we are replacing 1/4 of the original
> $ git am -s mbox ;# that single patch
> $ git show-branch HEAD @{-1}
> [...]
> The most natural thing to do at this point is
>
> $ git cherry-pick -3 @{-1}
>
> But we know range-pick is buggy and loses core.rewriteref, so
> instead I did this, which I know carries the notes forward:
>
> $ git rebase --onto HEAD @{-1}~3 @{-1}^0
Interesting. I'd have probably done it with an interactive rebase:
$ git rebase -i HEAD~4
[change first "pick" to "edit"; after stopping...]
$ git reset --hard HEAD^ ;# throw away patch 1
$ git am -s mbox ;# apply single patch
$ git rebase --continue
Which is really the same thing, but "cheats" around the cherry-pick
problem by using rebase (which I think handles the rewriteref stuff
correctly even in interactive mode).
I guess if we wanted to be really fancy, just replacing the first "pick"
with "x git am -s mbox" would automate it. That might be handy for the
multi-patch case.
Anyway, thanks for handling it. :)
-Peff