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

Re: [PATCH] stash: added safety flag for stash clear subcommand

From
NGNadav Goldstein <nadav.goldstein@blazepod.co>
Date
May 18, 2022, 18:53 UTC
Message-ID
<CAApwGmCsQNK42=5x1OxdovgVxdzj2Vs5H1FaUJhAGCXvmA5pzw@mail.gmail.com>
Thank you all for your detailed replies!

I thought deeply on the issues that you presented, and I wonder whether modeling after git clean --dry-run accomplish the goal I aimed to solve. If we make "git stash clear" to by default not clear the stash and just present the stashes to be dropped (and require -f to force clearing the stash), wouldn't we essentially make a duplicate of "git stash list"?

My goal is to not be afraid to have git stash clear in your terminal history, while indeed performing the clearing of the whole stack when fired.

I thought presenting a confirmation dialog before clearing would suffice as a solution, but I like the idea of listing all of the stashes to be dropped and requesting confirmation (and in the future allow selection of specific stashes to be dropped as you suggested).

Regarding making it opt out instead of opt in, I am afraid there are tools that use git stash clean automatically, and making the confirmation opt-out (by default confirm) we can potentially break them, don't you think it would be more gentle to the git community to make it opt in? Of course one major downside is that users need to "find" it so the adaptation will be much slower, but I feel it's for the best.

What do you think? I do agree that --interactive is not a good name and a bit misleading, can you help me think of a better name that will be more of a suit? maybe -c|--confirm, and using stashClear.requireConfirm? Or -p|--prompt?

Next: Junio C Hamano
Message 1 of 2 in “Re: [PATCH] stash: added safety flag for stash clear subcommand”
  1. Nadav GoldsteinMay 18, 2022
  2. Junio C HamanoMay 18, 2022

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.