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

Re: [PATCH] rebase: learn --discard subcommand

From
Jonathan Nieder <jrnieder@gmail.com>
Date
May 28, 2011, 22:50 UTC
Message-ID
<20110528225046.GA31449@elie>
In-Reply-To
<SNT124-W247D44D043F692CA06747EC4790@phx.gbl>
Hi,
Tim Mazid wrote:
> I'd just like to say that I sometime use "git reset --hard" in the middle
> of a "git rebase" when I want to get rid of some changes completely.
> Now, I'm not saying that this is the best way of doing it ("git checkout --"
> is probably far superior?)
 . "git checkout -- ." to discard unadded changes
 . "git checkout HEAD -- ." to discard uncommitted changes
 . "git reset --keep HEAD^" to work against a different commit
 . "git reset --merge" to discard a merge resolution in progress

While I also would be happy to see "git reset --hard" to abort am/rebase, I see two problems, one with an obvious solution, the other not:

1. It would be a big change in behavior that directly goes against
muscle memory, as you mentioned.  This part could be mitigated by
providing "undo" functionality (e.g., renaming the .git/rebase-merge
directory instead of deleting it) and printing advice including a
command that gets the sequencer state back.
2. It does not help people like me who are fearful about scribbling
over accidentally unstaged or uncommitted changes.  This could be
mitigated by also providing forget-sequence functionality through
separate commands like "git rebase --discard".
Previous: Tim MazidNext: Martin von Zweigbergk
Message 6 of 17 in “rebase: learn --discard subcommand”
  1. rebase: learn --discard subcommandMartin von Zweigbergk, May 28, 2011
  2. Ramkumar RamachandraMay 28, 2011
  3. Martin von ZweigbergkMay 29, 2011
  4. Junio C HamanoMay 28, 2011
  5. Tim MazidMay 28, 2011
  6. Jonathan NiederMay 28, 2011
  7. Martin von ZweigbergkMay 29, 2011
  8. Jakub NarebskiMay 29, 2011
  9. Michael HaggertyMay 30, 2011
  10. Jonathan NiederMay 28, 2011
  11. Tim MazidMay 29, 2011
  12. Martin von ZweigbergkMay 29, 2011
  13. Jonathan NiederMay 29, 2011
  14. Michael HaggertyMay 30, 2011
  15. Tim MazidMay 30, 2011
  16. Michael HaggertyMay 30, 2011
  17. Miles BaderMay 30, 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.