Re: Git reset --hard with staged changes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Yotam Gingold <yotam@xxxxxxxxxxxxxxxx> 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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]