git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Question about git revert

From
Christian Couder <chriscool@tuxfamily.org>
Date
Jul 8, 2010, 03:05 UTC
Message-ID
<201007080505.02633.chriscool@tuxfamily.org>
In-Reply-To
<20100708015019.GP10042@volcano.builtonlinux.com>
On Thursday 08 July 2010 03:50:19 Hal Eisen wrote:
Show 15 quoted lines
> 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.

Show 5 quoted lines
> 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.

Previous: Hal EisenNext: Elijah Newren
Message 2 of 3 in “Question about git revert”
  1. Hal EisenJul 8, 2010
  2. Christian CouderJul 8, 2010
  3. Elijah NewrenJul 8, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.