git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Duy Nguyen <pclouds@gmail.com>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: Is git-checkout's restoring d/f conflict really sane?
Date: Tue, 14 May 2019 19:37:15 +0900	[thread overview]
Message-ID: <xmqq8sv99vac.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <CACsJy8Bew3i6AL_XWfhLhCvdSFYVCGoEQepi9KLmSDPVmDu5Zg@mail.gmail.com> (Duy Nguyen's message of "Tue, 14 May 2019 16:41:23 +0700")

Duy Nguyen <pclouds@gmail.com> writes:

> $ echo data > one
> $ git add one
> $ rm one
> $ mkdir one
> $ echo two > one/two
> $ echo three > one/three
> $ git checkout one
> $ ls -l one
> -rw-r--r-- 1 pclouds pclouds 5 May 14 16:36 one
>
> Replacing a file is one thing. In this case we're deleting a directory
> and unknown number of files inside (in this case 'two' and 'three').
> Is this really a good thing to do?
>
> If it's not but too late to do anything about git-checkout, could
> git-restore do something better (and exactly what)?

The user said "I do not want whatever I have under name 'one' in the
working tree, and I want what I have as 'one' in the index instead",
so I tend to think that failing the request would be a disservice.

I suspect that this will become even more right thing to do, in the
new world where the no-overlay mode becomes the default.  Unlike
"checkout HEAD ."  that only adds to the set of paths in the working
tree, "restore HEAD ." will remove what's in the working tree and in
the index but not in the HEAD, no?


  reply	other threads:[~2019-05-14 10:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-14  9:41 Is git-checkout's restoring d/f conflict really sane? Duy Nguyen
2019-05-14 10:37 ` Junio C Hamano [this message]
2019-05-14 10:49   ` Duy Nguyen
2019-05-15  1:56     ` 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

  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=xmqq8sv99vac.fsf@gitster-ct.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=pclouds@gmail.com \
    /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).