From: Junio C Hamano <gitster@pobox.com>
To: Robin Moussu <moussu.robin@pm.me>
Cc: "git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: Request: `git restore $commit $file` shouldn’t override uncommited changes
Date: Wed, 28 Apr 2021 16:23:53 +0900 [thread overview]
Message-ID: <xmqqbl9yc1o6.fsf@gitster.g> (raw)
In-Reply-To: <pYZzGPZTHnJjYBKrUAVGcso74I_xJgfzNpSwDN94fhYcDoOamp62-IFvxVrU056uw0txy3MTHYSwny_II0XY4trSY5_E25q7EXwhNHjy3VY=@pm.me> (Robin Moussu's message of "Tue, 27 Apr 2021 17:37:59 +0000")
Robin Moussu <moussu.robin@pm.me> writes:
> That’s the first time I’m interacting with the git community,
> I’m not very familiar with the process. I hope I’m at the right
> place for a feature request.
>
> Currently, I don’t think that it’s possible to get an error when
> copying the content of a file from another revision into your
> working tree if said file has uncommitted changes.
Yes, "git restore <from-where> <pathspec>" is like "I made a mess in
the paths <pathspec> in the working tree and I want to start from a
known state, so please take the contents for these paths from
<from-where> and overwrite the garbage I have in the working tree".
It would be a grave regression to stop overwriting by default, as it
misses the entire point of the command.
The same applies to "git checkout <from-where> -- <pathspec>".
prev parent reply other threads:[~2021-04-28 7:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-27 17:37 Request: `git restore $commit $file` shouldn’t override uncommited changes Robin Moussu
2021-04-27 19:29 ` Johannes Altmanninger
2021-04-28 8:35 ` Robin Moussu
2021-04-28 9:10 ` Junio C Hamano
2021-04-28 7:23 ` Junio C Hamano [this message]
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqbl9yc1o6.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=moussu.robin@pm.me \
/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.
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 NNTP newsgroup(s).