Re: [PATCH] checkout: add --autostash option for branch switching
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Apr 14, 2026, 17:42 UTC
- Message-ID
- <xmqqy0ipa169.fsf@gitster.g>
- In-Reply-To
- <xmqqmrz5eklt.fsf@gitster.g>
Junio C Hamano <gitster@pobox.com> writes:
Show 17 quoted lines
> Harald Nordgren <haraldnordgren@gmail.com> writes: > >> Sounds reasonable, but wouldn't it make more sense to call it "autostash >> from master". We should still be able to abort the merge and merge it to >> some other branch. I feel like the source is more relevant than the >> destination, no? > > The new comment is for reminder, so "I made this while switching > from 'master' to this new 'topic'" theoretically has more reminding > value than "I made this while switching to this new 'topic'". As I > outlined my workflow, I usually am on 'master' or 'next' when I end > up needing "co -m" option, so "I was on 'master' when I stashed > this" has a much weaker reminding value. Just like a series of > "autostash" without any context comment irritated me, I'll see many > "autostash on master" that I cannot quite distinguish. > > But that may be just me.
Thinking about it a bit more, I doubt it would be just me.
The whole point of "git checkout -m other-branch" is "oops, I started working on this thing while I am on <this> branch, but all of this changes are irrelevant in the context of this branch and I realize that they are better done in the context of that other branch". So as a name that reminds readers of "git stash list" what this particular stash entry is about, the name of that other branch you were switching to is much more relevant than the branch you were on when you started working on.