From: Steven Date: Fri, 10 Sep 2010 14:54:11 GMT Subject: Re: git revert ignore whitespace Message-ID: <15732.91.183.48.98.1284130451.squirrel@stevenleeuw.kwik.to> In-Reply-To: <20100910142114.GB6936@sigill.intra.peff.net> 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 | git apply --reverse --ignore-whitespace -C0 git add 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