From: Junio C Hamano <gitster@pobox.com>
To: Yotam Gingold <yotam@yotamgingold.com>
Cc: Christian Couder <christian.couder@gmail.com>, git <git@vger.kernel.org>
Subject: Re: Git reset --hard with staged changes
Date: Mon, 30 May 2016 23:02:03 -0700 [thread overview]
Message-ID: <xmqqvb1u7okk.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <4067AC3B-D369-4E86-9EB9-ED19FD362E2D@yotamgingold.com> (Yotam Gingold's message of "Mon, 30 May 2016 01:07:49 -0400")
Yotam Gingold <yotam@yotamgingold.com> writes:
> I read Junio's enumerations of the situations, and I appreciate that the
> current behavior of git reset --hard cannot be changed because of the
> many tools that rely on the current behavior. After reading it, I have
> modified my proposed amendment to the git reset --hard documentation:
>
> A file is considered tracked if it exists in a prior commit or in the
> staging area. Note that a newly added file not in any prior commit will be
> removed. This is useful for aborting a failed merge.
>
> Shall I submit a patch?
I think the root cause of the confusion is that the description of
"reset --hard" uses an undefined word "tracked", which does not
appear anywhere else in "git reset --help".
A better rewrite is probably a one that does not to use such a fuzzy
word that is not even in official Git lingo (there is no glossary
entry for it).
Documentation/git-reset.txt | 10 ++++++++--
t/perf/perf-lib.sh | 4 +++-
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/Documentation/git-reset.txt b/Documentation/git-reset.txt
index 25432d9..c4cc035 100644
--- a/Documentation/git-reset.txt
+++ b/Documentation/git-reset.txt
@@ -65,8 +65,14 @@ If `-N` is specified, removed paths are marked as intent-to-add (see
linkgit:git-add[1]).
--hard::
- Resets the index and working tree. Any changes to tracked files in the
- working tree since <commit> are discarded.
+ Reset the index and the working tree to be identical to the
+ tree of the given <commit> (defaults to HEAD) by discarding
+ the changes made to them relative to <commit>. Paths
+ modified in the index and in the working tree are reset to
+ what is recorded in <commit>. Paths removed in the working
+ tree and in the index are resurrected from <commit>. Paths
+ added to the index and the working tree since <commit> are
+ removed.
--merge::
Resets the index and updates the files in the working tree that are
next prev parent reply other threads:[~2016-05-31 6:02 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-23 0:55 Git reset --hard with staged changes Yotam Gingold
2016-05-23 17:05 ` Junio C Hamano
2016-05-23 19:31 ` Christian Couder
2016-05-23 21:16 ` Junio C Hamano
2016-05-24 6:20 ` Christian Couder
2016-05-30 5:07 ` Yotam Gingold
2016-05-31 6:02 ` Junio C Hamano [this message]
2016-05-31 6:41 ` Christian Couder
[not found] <CANWD=rWmzgAwTp=E_1=th0Myk-dh4m5Y9PE3=fpHeirsVVQKwQ@mail.gmail.com>
2014-06-09 11:24 ` Pierre-François CLEMENT
2014-06-09 14:04 ` David Kastrup
2014-06-09 23:22 ` Pierre-François CLEMENT
2014-06-09 23:28 ` Junio C Hamano
2014-06-10 14:59 ` Pierre-François CLEMENT
2014-06-10 15:27 ` David Kastrup
2014-06-10 16:30 ` Pierre-François CLEMENT
2014-06-10 1:03 ` Dale Worley
2014-06-10 5:44 ` 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=xmqqvb1u7okk.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox.com \
--cc=christian.couder@gmail.com \
--cc=git@vger.kernel.org \
--cc=yotam@yotamgingold.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.
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.