All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Robin Moussu <moussu.robin@pm.me>
Cc: Johannes Altmanninger <aclopte@gmail.com>,
	"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 18:10:35 +0900	[thread overview]
Message-ID: <xmqqy2d2ai5w.fsf@gitster.g> (raw)
In-Reply-To: <I_ZK84DfFkUoO9FcqjidSjmsvktNt-k4tPiAGNIP5ztKjk0RQCfFmyRrRHaB414UaWsJO7kWPBcgHlRqAecH7r9mAj0TLm5k6T5_YzmiZ4c=@pm.me> (Robin Moussu's message of "Wed, 28 Apr 2021 08:35:46 +0000")

Robin Moussu <moussu.robin@pm.me> writes:

> On the contrary, if `--source $commit` is specified, I would like
> to get an error if $file has uncommitted changes.

Not necessarily.  I've done this number of times:

 - start from the current state (HEAD), make changes

 - end up making a mess that I'd rather not use.

 - realize that the endgame I seek is fairly close to the work I did
   for another branch.

 - "git checkout $that_branch -- $those_paths".

So, it is not cut-and-dried that it _always_ (or even _often_) is a
mistake to try overwriting a working tree file with modifiations with
a version of a file from commit that is not HEAD.  It may be _always_
an error for your work habit.  It would almost always be what I want
in my experience for me.



  reply	other threads:[~2021-04-28  9:10 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 [this message]
2021-04-28  7:23 ` Junio C Hamano

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=xmqqy2d2ai5w.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=aclopte@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.