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

Re: [RFC PATCH] revert: Implement --abort processing

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Jun 1, 2011, 19:00 UTC
Message-ID
<20110601190006.GB9730@elie>
In-Reply-To
<1306944446-11031-1-git-send-email-artagnon@gmail.com>
Ramkumar Ramachandra wrote:
> To abort, perform a "rerere clear" and "reset --hard" to the ref
> specified by the HEAD file introduced earlier in the series.
The above doesn't explain why, so it makes it harder to answer:
>  Should I be
>  re-implementing "reset --hard" like this?

So I'll try to fill in the blanks. Wouldn't it be better to call "reset --merge" code? That is what "git merge --abort" does.

Let's consider an example.

Suppose I have run "git cherry-pick foo" and run into a conflict. Now I start to fix things up the way I like, but I suddenly realize that the cause was cherry-picking the wrong commit; it's better to start over and do that. So I try to abort.

I have some changes to files that did not participate in the automatic cherry-pick:

 1. for unrelated reasons, I bumped the version number in the Makefile
 as a reminder not to forget later, without commiting it or marking
 with "git add";
 2. I (manually) moved a declaration to a different header file to
 reflect differences between the codebase at the time of foo^ and HEAD,
 to get it to compile.  Which works, so I mark it with "git add" for
 incorporation into the corrected cherry-pick commit.

With "git reset --merge", (1) is left alone, while (2) is backed out, unmerged entries are of course clobbered, and hazy cases in which I make some changes, "git add", and then make more changes without "git add" cause the operation to error out. It would be nicer if git could read my mind, but at first glance this seems like an okay second-best.

Are there other considerations or situations that would lead to a different conclusion? (Not a rhetorical question.)

Hope that helps, Jonathan

Previous: Junio C HamanoNext: Ramkumar Ramachandra
Message 4 of 6 in “revert: Implement --abort processing”
  1. revert: Implement --abort processingRamkumar Ramachandra, Jun 1, 2011
  2. Sverre RabbelierJun 1, 2011
  3. Junio C HamanoJun 1, 2011
  4. Jonathan NiederJun 1, 2011
  5. Ramkumar RamachandraJun 2, 2011
  6. Junio C HamanoJun 2, 2011

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.