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

Re: Add 'sane' mode to 'git reset'

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Dec 1, 2008, 18:06 UTC
Message-ID
<alpine.LFD.2.00.0812011003360.3256@nehalem.linux-foundation.org>
In-Reply-To
<32541b130812010944k3dd825e4pfa8c270ecc75d539@mail.gmail.com>
On Mon, 1 Dec 2008, Avery Pennarun wrote:
> 
> For reference, I advised someone just yesterday to use "git reset
> HEAD^" to undo an accidental "commit -a" instead of just "commit".
Yeah, I guess the --mixed default of "git reset" is occasionally useful.
> Also, as far as I know, "git reset HEAD filename" is the only
> recommended way to undo an accidental "git add".

The path-name based ones are actually a totally different animal than the non-pathname version of "git reset". With pathnames, it won't change the actual HEAD, so it's really a totally different class of command, just sharing a name.

But:
> How about calling it --merge instead?  That's really what it does:
> merges the diffs from (your current index) to (the requested index)
> into (your working tree and your index).
Sure, "git reset --merge" would probably be a fine form.
		Linus
Previous: Jakub NarebskiNext: Junio C Hamano
Message 4 of 8 in “Add 'sane' mode to 'git reset'”
  1. Linus TorvaldsDec 1, 2008
  2. Avery PennarunDec 1, 2008
  3. Jakub NarebskiDec 1, 2008
  4. Linus TorvaldsDec 1, 2008
  5. Junio C HamanoDec 3, 2008
  6. Linus TorvaldsDec 4, 2008
  7. Document "git-reset --merge"Junio C Hamano, Dec 4, 2008
  8. Junio C HamanoDec 4, 2008

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.