Re: [BUG?] Patches created with 'diff.noprefix=true' don't 'git apply'.
- From
Jonathan Nieder <jrnieder@gmail.com>
- Date
- May 6, 2014, 01:59 UTC
- Message-ID
- <20140506015927.GV9218@google.com>
- In-Reply-To
- <CAO8RVveV4SgXmJzWpYnyB3rnQALQkrrLNtLL5Ej5Y9Mjjekmmw@mail.gmail.com>
Nathan Collins wrote:
> On Wed, Apr 30, 2014 at 7:40 PM, Jonathan Nieder <jrnieder@gmail.com> wrote: >> Nathan Collins wrote:
Show 11 quoted lines
>>> git show | git apply --reverse >> >> The following which only uses plumbing commands should work: >> >> git diff-tree -p HEAD^! | >> git apply --reverse > > Nice! However, I don't now how to generalize this solution to other > (probably insane) use cases, e.g. > > git log -S<string> --patch | git apply --reverse
This should do it:
git rev-list HEAD | git diff-tree --no-commit-id -p -S<string> --stdin | git apply --reverse
More generally, when scripting plumbing commands tend to do the right thing.
Will think more about the documentation and other parts (or if someone else sends a patch before I can, I won't mind).
Thanks, Jonathan