git/git.github.io

[feat] `git stash pop --abort`

trusktr opened this issue · 1 comments

Just like some other commands like rebase and merge have an --abort option to undo changes, it would be excellent if the stach (or maybe stash pop directly) had an --abort option too.

It is currently difficult to undo a stash with conflicts (or, perhaps not entirely clear how, although I'm sure it may be easy for the experts).

One problem with a conflicted git stash pop is that, although the output says the following,

  (use "git restore --staged <file>..." to unstage)

running that command on those files results in

error: path 'src/core/ChildTracker.ts' is unmerged

and there is no further explanation on what to do.

A git stash --abort or git stash pop --abort command would simply undo the conflicted stash, and restore to the previous state very similarly to git merge --abort or git rebase --abort


Note I know this isn't the best place to post, but I truly cannot use email threads efficiently. My email is quite a mess, messages are difficult to read, formatting is difficult, and I try to prioritize only personal conversations in my email only. I like to have a place to go to for each community I want to chat with. Have you considered opening up the Discussions tab on the Git repo?

Plus we get super nifty benefits here like Markdown formatting:

int cmd_main(int argc, const char **argv)
{
	const char *cmd;
	int done_help = 0;

Hi! Unfortunately, as you've noticed this isn't the best place to post this discussion. Git's development and related discussions community primarily happen in the Git mailing list. That's also the best place to send your feature request. Interestingly, there seems to have been a related discussion about introducing the --abort flag for stash which you might find relevant.

In case you're eager enough to give this a try, you could feel free to do so and contribute the same to Git. GitGitGadget might help you contribute the patches through GitHub PRs.

Hope this helps 🙂