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

Re: Warning suggestion for git stash drop

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 30, 2017, 19:21 UTC
Message-ID
<xmqqinjdqo1i.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<CAFirYm_UzUe=zSefAVpt45OuEwKyn7bAZbumLXYWbPFVRahPew@mail.gmail.com>
Laurent Humblet <laurent.humblet@gmail.com> writes:
Show 8 quoted lines
> Thank you for your feedback.
>
> I suppose that turning a hypothetical confirmation option 'on' would
> impact a stash pop for instance as it automatically drops the stash if
> it was applied without conflicts.
>
> What about a --confirm flag?  You could then simply alias 'git stash
> drop --confirm' locally and it wouldn't impact anything else?

I think that is probably trivial to add, but how would you make sure you give it? One way may be to train your fingers to type "git sd" with something like this in your ~/.gitconfig:

	[alias] sd = "stash drop --confirm"

but at that point, you could instead have something like the following in you ~/bin/git-sd and get the same effect:

	#!/bin/sh
	if tty -s
	then
		echo >&2 "are you sure you want to drop all stash entries?"
		case "$(read)" in
		[Yy]*) ;;
		*) echo >&2 "ok, let's not drop 'em"; exit 0 ;;
                esac
	fi
	exec git stash drop
without adding the "--confirm" option at all.

So I am not sure that would get us closer to a satisfactory solution to your original problem.

Retroactively adding an end-user safety is hard.
> Have a great week-end!
You too.
Previous: Laurent HumbletNext: Laurent Humblet
Message 5 of 6 in “Warning suggestion for git stash drop”
  1. Laurent HumbletJun 29, 2017
  2. Junio C HamanoJun 29, 2017
  3. Stefan BellerJun 29, 2017
  4. Laurent HumbletJun 30, 2017
  5. Junio C HamanoJun 30, 2017
  6. Laurent HumbletJul 18, 2017

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.