Thread (4 messages) flat view 4 messages, 2 authors, 2016-06-15

Re: git revert ignore whitespace

From: Jeff King <hidden>
Date: 2016-06-15 22:49:31

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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help