git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Phillip Wood <phillip.wood123@gmail.com>
Cc: "Torsten Bögershausen" <tboegi@web.de>,
	phillip.wood@dunelm.org.uk, git@vger.kernel.org,
	friebetill@gmail.com, "Eric Sunshine" <sunshine@sunshineco.com>
Subject: Re: [PATCH v1 1/1] git stash needing mkdir deletes untracked file
Date: Tue, 15 Aug 2023 11:03:49 -0700	[thread overview]
Message-ID: <xmqqcyzoji7u.fsf@gitster.g> (raw)
In-Reply-To: <9f76de24-d337-ed41-fb81-888dba0b1656@gmail.com> (Phillip Wood's message of "Tue, 15 Aug 2023 10:15:37 +0100")

Phillip Wood <phillip.wood123@gmail.com> writes:

> I don't think we should be treating "git stash" as a special case here
> - commands like "git checkout" should not be removing untracked files
> unprompted either.

Yeah, I tend to agree.  "git checkout branch path" should overwrite
a leftover "path" in the working tree in response to such an
explicit request, and that should equally apply for a request with
pathspec e.g. "git checkout branch .", as the latter is also an
explicit "please check out all paths out of the tree-ish of the
branch".

But "git checkout branch" in a working tree with untracked "path"
should not lose it if "branch" has it as a tracked file.

> I think stopping and telling the user that the file would be
> overwritten as we do in other cases would be better.

Yup, that is what we have done and probably one of the design
choices that made us successful.

>> Reading the different reports and including own experience,
>> I still think that a directory called ".deleted-by-user"
>> or ".wastebin" or something in that style is a good idea.
>
> I can see an argument for being able to opt-in to that for "git
> restore" and "git reset --hard" but that is a different problem to the
> one here.

Yeah, I tend to agree.  If anything, such a trash directory should
be kept out-of-line, not inside the working tree.  Perhaps in $HOME
or somewhere, and not necessarily tied to the use of Git, as the way
a file gets "deleted by user" is not necessarily limited to the use
of Git.


  parent reply	other threads:[~2023-08-15 18:05 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-21 17:31 Lost files after git stash && git stash pop Till Friebe
2023-07-22 21:44 ` Torsten Bögershausen
2023-07-23 10:01   ` Phillip Wood
2023-07-23 20:52     ` Torsten Bögershausen
2023-07-24  9:59       ` Phillip Wood
2023-08-08 17:26 ` [PATCH v1 1/1] git stash needing mkdir deletes untracked file tboegi
2023-08-08 18:03   ` Torsten Bögershausen
2023-08-08 19:28   ` Eric Sunshine
2023-08-09 13:15   ` Phillip Wood
2023-08-09 18:47     ` Torsten Bögershausen
2023-08-15  9:15       ` Phillip Wood
2023-08-15 15:25         ` Torsten Bögershausen
2023-08-15 18:03         ` Junio C Hamano [this message]
2023-08-09 20:57     ` Junio C Hamano
2023-08-15  9:16       ` Phillip Wood

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqcyzoji7u.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=friebetill@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=phillip.wood123@gmail.com \
    --cc=phillip.wood@dunelm.org.uk \
    --cc=sunshine@sunshineco.com \
    --cc=tboegi@web.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).