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

Re: [RFC/PATCH 1/2] Documentation: suggest "reset --merge" more often

From
Stephen Boyd <bebarino@gmail.com>
Date
Nov 3, 2010, 09:32 UTC
Message-ID
<4CD12C1C.2020507@gmail.com>
In-Reply-To
<20101029083836.GB26290@burratino>
On 10/29/10 01:38, Jonathan Nieder wrote:
Show 26 quoted lines
> With its new semantics, "git reset --merge" is more suitable for
> undoing a failed merge than "git reset --hard" is.  It is especially
> nice if you forget that you are in a merge and make a change or two:
> 
>   git merge something-complicated
>   ... notice conflicts, walk away ...
>   vi foo.c
>   git commit; # fails because the index has unmerged entries
>   git reset --merge
> 
> The modern (post-1.7.0) semantics of git reset --merge ensure that
> the changes to foo.c will be preserved by this sequence of commands,
> unless foo.c was one of the files with conflicts.
> 
> So in the spirit of ed4a6baa (Documentation: suggest `reset --merge`
> in How Merge Works section, 2010-01-23), recommend it in place of
> "reset --hard".
> 
> One caveat: for habitual adders-to-index, "git reset --merge" is
> no better than "git reset --hard" (though still no worse).
> 
>   vi foo.c
>   git add -u
>   git diff --cached --check; # fails because conflict markers are present
>   git reset --merge; # equivalent to git reset --hard
> 

Would it also be a good idea to fill in the hint in git status for the in_merge case with similar information?

Previous: Jonathan NiederNext: Jonathan Nieder
Message 3 of 10 in “Documentation: kicking the "reset --hard" habit”
  1. 0/2 Documentation: kicking the "reset --hard" habitJonathan Nieder, Oct 29, 2010
  2. 1/2 Documentation: suggest "reset --merge" more oftenJonathan Nieder, Oct 29, 2010
  3. Stephen BoydNov 3, 2010
  4. 2/2 Documentation: suggest "reset --keep" more oftenJonathan Nieder, Oct 29, 2010
  5. Matthieu MoyOct 30, 2010
  6. Junio C HamanoOct 31, 2010
  7. Matthieu MoyOct 31, 2010
  8. Oldest Currently Distributed Git {Re: [RFC/PATCH 0/2] Documentation: kicking the "reset --hard" habit}Drew Northup, Nov 5, 2010
  9. Ævar Arnfjörð BjarmasonOct 31, 2010
  10. J. Bruce FieldsNov 1, 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.