Re: git revert ignore whitespace
- From
Jeff King <peff@peff.net>
- Date
- Sep 10, 2010, 14:21 UTC
- Message-ID
- <20100910142114.GB6936@sigill.intra.peff.net>
- In-Reply-To
- <14756.91.183.48.98.1284105472.squirrel@stevenleeuw.kwik.to>
On Fri, Sep 10, 2010 at 09:57:52AM +0200, Steven wrote:
> I want to revert a specific commit using 'git revert', > however in the meantime there were some whitespace changes. > Is it still possible to do this? The manual doesn't mention a -w or > --ignore-whitespace option for git revert.
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`'"
which is more or less what revert will do (actually, I think it will do more with 3-way merges during the application, but the point is that a revert in git is nothing more than achieving a tree state that pulls out the reverted content, and then making a commit. It has no special status in the history graph).
-Peff