git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Question about git revert
@ 2010-07-08  1:50 Hal Eisen
  2010-07-08  3:05 ` Christian Couder
  2010-07-08  4:51 ` Elijah Newren
  0 siblings, 2 replies; 3+ messages in thread
From: Hal Eisen @ 2010-07-08  1:50 UTC (permalink / raw)
  To: git

I did a search of the archives for this mailing list, and couldn't
find anything applicable.

I am having the same problem as Joshua Cheek.  He asked this question
on StackOverflow about a month ago.

http://stackoverflow.com/questions/2938301/git-remove-specific-commit

There are no merges involved.  I would be perfectly happy having
another commit in my history which documents the reverting of a prior
commit.

The problem seems to stem from git-revert not properly calculating the
"cleanness" of the prior commit, and incorrectly thinking that later
commits depend on the to-be-reverted commit.

I have seen other web sites which suggest using git to manually
generate a diff, and then applying it as a reverse patch, but that
seems like a kludge.

What is the best solution for this use case?

Thanks,
Hal

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Question about git revert
  2010-07-08  1:50 Question about git revert Hal Eisen
@ 2010-07-08  3:05 ` Christian Couder
  2010-07-08  4:51 ` Elijah Newren
  1 sibling, 0 replies; 3+ messages in thread
From: Christian Couder @ 2010-07-08  3:05 UTC (permalink / raw)
  To: Hal Eisen; +Cc: git

On Thursday 08 July 2010 03:50:19 Hal Eisen wrote:
> I did a search of the archives for this mailing list, and couldn't
> find anything applicable.
> 
> I am having the same problem as Joshua Cheek.  He asked this question
> on StackOverflow about a month ago.
> 
> http://stackoverflow.com/questions/2938301/git-remove-specific-commit
> 
> There are no merges involved.  I would be perfectly happy having
> another commit in my history which documents the reverting of a prior
> commit.
> 
> The problem seems to stem from git-revert not properly calculating the
> "cleanness" of the prior commit, and incorrectly thinking that later
> commits depend on the to-be-reverted commit.

You may want to try "git revert" with the new --strategy option,
for example "git revert --strategy resolve <commit>". This option is not in a 
released version yet, so you should use one of the last git version from the 
master branch, for example v1.7.2-rc2.

> I have seen other web sites which suggest using git to manually
> generate a diff, and then applying it as a reverse patch, but that
> seems like a kludge.
> 
> What is the best solution for this use case?

It depends on how well the revert algorithms work in the case you are 
interested in. If one strategy works quite well, then manually fixing the few 
remaining problems, if any, in the result is probably the best solution. 

Regards,
Christian.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Question about git revert
  2010-07-08  1:50 Question about git revert Hal Eisen
  2010-07-08  3:05 ` Christian Couder
@ 2010-07-08  4:51 ` Elijah Newren
  1 sibling, 0 replies; 3+ messages in thread
From: Elijah Newren @ 2010-07-08  4:51 UTC (permalink / raw)
  To: Hal Eisen; +Cc: git

Hi,

On Wed, Jul 7, 2010 at 7:50 PM, Hal Eisen <eisen@dunhackin.org> wrote:
> I did a search of the archives for this mailing list, and couldn't
> find anything applicable.
>
> I am having the same problem as Joshua Cheek.  He asked this question
> on StackOverflow about a month ago.
>
> http://stackoverflow.com/questions/2938301/git-remove-specific-commit
>
> There are no merges involved.  I would be perfectly happy having
> another commit in my history which documents the reverting of a prior
> commit.
>
> The problem seems to stem from git-revert not properly calculating the
> "cleanness" of the prior commit, and incorrectly thinking that later
> commits depend on the to-be-reverted commit.

Reverts will only be clean if you're undoing changes on lines that
haven't been touched in subsequent commits AND the 3 lines on both
sides of such changes have not been modified either.  (The 3 lines of
context means that in your example, later commits _do_ depend on the
to-be-reverted commit).  In your example, you're dealing with a file
with only three lines, one line added per commit.  Thus, in that
example, you can't revert any of the commits cleanly except the last.

> I have seen other web sites which suggest using git to manually
> generate a diff, and then applying it as a reverse patch, but that
> seems like a kludge.

This solution would have the exact same problem (unless you created a
patch with 0 lines of context).

> What is the best solution for this use case?

Manually fix the conflict.  Or see Christian's email about using
special strategies, if you can find or write one for this special case
that doesn't depend on context lines (a strategy that is usually not
desirable for source code).


Hope that helps,
Elijah

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-07-08  4:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-08  1:50 Question about git revert Hal Eisen
2010-07-08  3:05 ` Christian Couder
2010-07-08  4:51 ` Elijah Newren

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).