git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Duy Nguyen <pclouds@gmail.com>
To: Phillip Wood <phillip.wood@dunelm.org.uk>
Cc: Git Mailing List <git@vger.kernel.org>,
	Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH 0/2] read-tree: improve untracked file support
Date: Tue, 7 May 2019 18:02:14 +0700	[thread overview]
Message-ID: <CACsJy8A+EjymUsSHD8Wj3y3=SfCkaWtfYhjqv+OyaXpkrQXkVg@mail.gmail.com> (raw)
In-Reply-To: <994d4687-39ed-91b9-cdf9-d4be39cbb2ba@gmail.com>

On Tue, May 7, 2019 at 5:02 PM Phillip Wood <phillip.wood123@gmail.com> wrote:
> > My (biased, obviously) view is that "git reset --hard" is very
> > dangerous and I'm not trying to change that, especially when its
> > behavior has been like this since forever and I'm sure it's used in
> > scripts.
> >
> > Instead "git restore" should be used when you need "git reset --hard
> > HEAD", the most often use case. And since it's new, changing default
> > behavior is not a problem. Which brings us back to git-restore :)
>
> Does restore clean up the branch state like reset? It's tricky because
> you only want to do that if there is no pathspec (or the pathspec is :/
> or equivalent - I can't remember if restore always requires paths or not)

Nope. git-restore cares about files, not branches. Yes git-restore
always requires paths, just in case people type "git restore" and
expect to see help usage or something.

> > But either way, git-restore or git-reset, I still don't see why
> > untracked files are more valuable in this case than tracked ones to
> > change the default.
>
> My issue is that is easy to see what changes you're going to lose in
> tracked files by running diff. For untracked files diff just says a new
> file will be created, it ignores the current contents as the path is in
> the index so it is easy to overwrite changes without realizing. There's
> also a philosophical point that git should not be stomping on paths that
> it is not tracking though that's a bit moot if a path is tracked in one
> revision but not another.

Ah good point about diff. If only we had "git reset --dry-run" (that
shows the diff, including untracked files; or perhaps --diff would be
a better name for that imaginary option)
-- 
Duy

      reply	other threads:[~2019-05-07 11:02 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-01 10:14 [PATCH 0/2] read-tree: improve untracked file support Phillip Wood
2019-05-01 10:14 ` [PATCH 1/2] read-tree --reset: add --protect-untracked Phillip Wood
2019-05-01 10:18   ` Duy Nguyen
2019-05-01 10:32     ` Duy Nguyen
2019-05-02 10:38   ` Duy Nguyen
2019-05-03 15:20     ` Phillip Wood
2019-05-01 10:14 ` [PATCH 2/2] read-tree: add --exclude-standard Phillip Wood
2019-05-01 10:31 ` [PATCH 0/2] read-tree: improve untracked file support Duy Nguyen
2019-05-01 14:58   ` Phillip Wood
2019-05-02 10:53     ` Duy Nguyen
2019-05-07 10:01       ` Phillip Wood
2019-05-07 11:02         ` Duy Nguyen [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

  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='CACsJy8A+EjymUsSHD8Wj3y3=SfCkaWtfYhjqv+OyaXpkrQXkVg@mail.gmail.com' \
    --to=pclouds@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=phillip.wood@dunelm.org.uk \
    /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).