Re: git revert ignore whitespace

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, September 10, 2010 16:21, Jeff King wrote:
>
> In theory there is no reason we couldn't support "-w", but I don't think
> there is a way to do it currently.
>
> You could just manually do the revert. Something like:
>
>   git diff-tree -p $commit | git apply --ignore-whitespace
>   git commit -m "revert '`git log -1 --format=%s $commit`'"
>

Thanks for the tip Jeff.

I had to modify the commands a bit to get it to work.
Here they are:
git diff-tree -p <commithash> | git apply --reverse --ignore-whitespace -C0
git add <file(s)>
git commit -m "revert '`git log -1 --format=%s $commit`'"

The --reverse is necessary to revert a patch, I needed the -C0 parameter
as well because the line above changed as well.
This was a fairly simple example, but I imagine it won't work at all with
a larger history, especially with more changes in the relevant sections
and additions/deletions. I believe git revert does take these into
account?

Kind regards,
Steven

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]