Re: Add 'sane' mode to 'git reset'
- From
Avery Pennarun <apenwarr@gmail.com>
- Date
- Dec 1, 2008, 17:44 UTC
- Message-ID
- <32541b130812010944k3dd825e4pfa8c270ecc75d539@mail.gmail.com>
- In-Reply-To
- <alpine.LFD.2.00.0812010908120.3256@nehalem.linux-foundation.org>
On Mon, Dec 1, 2008 at 12:30 PM, Linus Torvalds <torvalds@linux-foundation.org> wrote:
Show 6 quoted lines
> So add this kind of mode to "git reset", and since it's probably the > sanest form of reset (it will not throw any state away), just call it > that: "git reset --sane". It should probably be the default, but we likely > cannot change the semantics of a regular "git reset", even though it is > unlikely that very many people really use the current (insane) default > mode of "--mixed" that only resets the index.
For reference, I advised someone just yesterday to use "git reset HEAD^" to undo an accidental "commit -a" instead of just "commit". Also, as far as I know, "git reset HEAD filename" is the only recommended way to undo an accidental "git add". (Which I do sometimes when I meant to write "git add -p".) Those two options are pretty common, I think, and are also perfectly "sane".
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).
Or --keep, because it keeps your working tree changes.
Have fun,
Avery