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

Re: [PATCH 7/7] rebase: implement --[no-]autostash and rebase.autostash

From
Ramkumar Ramachandra <artagnon@gmail.com>
Date
Apr 24, 2013, 08:27 UTC
Message-ID
<CALkWK0=JsR9txrrnWZKyrTpv-s+ZgVz-cL6ZsMn2R+wz6rE4FA@mail.gmail.com>
In-Reply-To
<CABURp0onypkDFiovYP4s0UuBV+oFp3rPv1Jq8dGbxZhKU_sgsQ@mail.gmail.com>
Phil Hord wrote:
Show 8 quoted lines
> Because I am in a git-rebase which has apparently failed, I would
> expect 'git rebase --abort' would save me here.  But it does not and
> you have given me some unique instructions to try to recover.  I
> suppose rebase--abort cannot be made to recover in this case because
> this is a rebase-wrapper and all of my rebase-state is already
> discarded.  But I would much prefer to have the normal "undo"-ability
> of git-rebase here, once I realize I have made a mistake or
> encountered conflicts I am not prepared to handle right now.

You're asking for a hammer solution, when I'm advocating a solution that offers more flexibility and control. Commits and worktree changes are fundamentally two different things, and I treat them differently.

rebase.autostash is simply a shortcut for:
    $ git stash && git rebase ... && git stash pop

Except that your stash is not blocked during the rebase process: we use a special stash. If the last 'git stash pop' fails, do you do this?

    $ git reset --hard HEAD@{1}
    $ git stash pop
    # snip, snip ...
    # redo the entire rebase

I _never_ find myself doing this; in your hammer solution, you're advocating that we always do this.

The stash is a powerful tool when used properly: a stash isn't attached to any branch, and therefore perfectly designed to keep small temporary worktree changes for a short period of time. rebase.autostash is _not_ a way to take away power from the user, or save the user from learning how to use stash.

That said, the current implementation is very rough and I will improve it in the next iterations. If the apply fails, I will push the changes onto stash@{0}, and let the user do a 'git stash pop' instead of having to remember (or copy out) a SHA-1 displayed in the terminal output. Essentially, this leaves the user in the exact same state as if she had done a 'git stash && git rebase ... && git stash pop'.

Previous: Phil HordNext: Matthieu Moy
Message 27 of 28 in “Introduce rebase.autostash”
  1. 0/7 Introduce rebase.autostashRamkumar Ramachandra, Apr 23, 2013
  2. 1/7 am: suppress error output from a conditionalRamkumar Ramachandra, Apr 23, 2013
  3. Martin von ZweigbergkApr 23, 2013
  4. Junio C HamanoApr 23, 2013
  5. Ramkumar RamachandraApr 23, 2013
  6. Junio C HamanoApr 23, 2013
  7. Ramkumar RamachandraApr 23, 2013
  8. 2/7 rebase -i: don't error out if $state_dir already existsRamkumar Ramachandra, Apr 23, 2013
  9. Martin von ZweigbergkApr 23, 2013
  10. Junio C HamanoApr 23, 2013
  11. Ramkumar RamachandraApr 23, 2013
  12. 3/7 am: tighten a conditional that checks for $dotestRamkumar Ramachandra, Apr 23, 2013
  13. Junio C HamanoApr 23, 2013
  14. 4/7 am: don't do housekeeping when rebasingRamkumar Ramachandra, Apr 23, 2013
  15. Junio C HamanoApr 23, 2013
  16. 5/7 rebase -i: return control to the caller, for housekeepingRamkumar Ramachandra, Apr 23, 2013
  17. Martin von ZweigbergkApr 23, 2013
  18. Ramkumar RamachandraApr 25, 2013
  19. Junio C HamanoApr 23, 2013
  20. 6/7 sh-setup: introduce require_clean_work_tree --quietRamkumar Ramachandra, Apr 23, 2013
  21. Junio C HamanoApr 23, 2013
  22. 7/7 rebase: implement --[no-]autostash and rebase.autostashRamkumar Ramachandra, Apr 23, 2013
  23. Junio C HamanoApr 23, 2013
  24. Junio C HamanoApr 23, 2013
  25. Ramkumar RamachandraApr 23, 2013
  26. Phil HordApr 23, 2013
  27. Ramkumar RamachandraApr 24, 2013
  28. Matthieu MoyApr 24, 2013

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.