Skip to contentSkip to conversation

git-reset.txt improvements

PATCH Superseded Michael J Gruber 3 participants 22 messages Jun 15, 2016 Documentation

lore
Share & tools
lore
#0 lore raw

cover git-reset.txt improvements

First of all: I've been out of the loop last week, so please forgive me if this comes at the wrong phase of a cycle.

I portioned the changes to git-reset.txt and ordered them starting from the least controversial, I hope. The descriptions of modes have grown organically over time, and this series tries to make them consistent in structure and wording, after cleaning up some minor issues. 6/6 is the "meat", so to say.

For the "--merge" description in 6/6: Please double check. I've tried to understand the mode from the tables and from the inner works (git read-tre -u -m plus carrying over unmerged entries) because I did not understand the original description.

Michael J Gruber (6):
git-reset.txt: clarify branch vs. branch head git-reset.txt: reset does not change files in target git-reset.txt: reset --soft is not a no-op git-reset.txt: use "working tree" consistently git-reset.txt: point to git-checkout git-reset.txt: make modes description more consistent

 Documentation/git-reset.txt |   63 ++++++++++++++++++++++++++-----------------
 1 files changed, 38 insertions(+), 25 deletions(-)
Signature · 1 line
1.7.3.rc1.215.g6997c
#1 lore raw

PATCH 1/6 git-reset.txt: clarify branch vs. branch head

"Change the branch" can be misunderstood to mean "change which branch is checked out". Make it clearer that git-reset changes the branch head of the currently checked out branch.

---
 Documentation/git-reset.txt |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
Documentation/git-reset.txt +2 -2
index 9cf3148..7d68b4c 100644
@@ -15,7 +15,7 @@ SYNOPSIS
 DESCRIPTION
 -----------
 In the first and second form, copy entries from <commit> to the index.
-In the third form, set the current branch to <commit>, optionally
+In the third form, set the current branch head to <commit>, optionally
 modifying index and worktree to match.  The <commit> defaults to HEAD
 in all forms.
 
@@ -36,7 +36,7 @@ This means that `git reset -p` is the opposite of `git add -p` (see
 linkgit:git-add[1]).
 
 'git reset' [--<mode>] [<commit>]::
-	This form points the current branch to <commit> and then
+	This form sets the current branch head to <commit> and then
 	updates index and working tree according to <mode>, which must
 	be one of the following:
 +
Signature · 1 line
1.7.3.rc1.215.g6997c
#2 lore raw

Re: [PATCH 1/6] git-reset.txt: clarify branch vs. branch head

Documentation/git-reset.txt This means that `git reset -p` is the opposite of `git add -p` (see · line 41

Quoted 8 lines · Michael J Gruber
Documentation/git-reset.txt +1 -1
@@ -36,7 +36,7 @@ This means that `git reset -p` is the opposite of `git add -p` (see
 linkgit:git-add[1]).
 
 'git reset' [--<mode>] [<commit>]::
-	This form points the current branch to <commit> and then
+	This form sets the current branch head to <commit> and then
 	updates index and working tree according to <mode>, which must
 	be one of the following:

Perhaps "resets" or "moves" is even clearer?

In any case I think this is an improvement.

#3 lore raw

PATCH 2/6 git-reset.txt: reset does not change files in target

In reply to Michael J Gruber

git-reset obviously cannot change files in an existing commit. Make it not sound as if it could: reset can change HEAD and, in that sense, can change which state a file in HEAD is in.

---
 Documentation/git-reset.txt |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Documentation/git-reset.txt +1 -1
index 7d68b4c..8fb871c 100644
@@ -295,7 +295,7 @@ file. For example, the first line of the first table means that if a
 file is in state A in the working tree, in state B in the index, in
 state C in HEAD and in state D in the target, then "git reset --soft
 target" will put the file in state A in the working tree, in state B
-in the index and in state D in HEAD.
+in the index and set HEAD to target (which has the file in state D).
 
       working index HEAD target         working index HEAD
       ----------------------------------------------------
Signature · 1 line
1.7.3.rc1.215.g6997c
#4 lore raw

Re: [PATCH 2/6] git-reset.txt: reset does not change files in target

Quoted 9 lines · Michael J Gruber

git-reset obviously cannot change files in an existing commit. Make it not sound as if it could: reset can change HEAD and, in that sense, can change which state a file in HEAD is in.
...

Documentation/git-reset.txt +0 -0
index 7d68b4c..8fb871c 100644

Documentation/git-reset.txt file. For example, the first line of the first table means that if a · line 298

Quoted 5 lines
Documentation/git-reset.txt +1 -1
@@ -295,7 +295,7 @@ file. For example, the first line of the first table means that if a
 file is in state A in the working tree, in state B in the index, in
 state C in HEAD and in state D in the target, then "git reset --soft
 target" will put the file in state A in the working tree, in state B
-in the index and in state D in HEAD.
+in the index and set HEAD to target (which has the file in state D).

I would further suggest to make it clear that soft reset does not touch either the index nor the working tree, e.g.:

"git reset --soft target" will leave the file in the working tree in state A and the index in state B. It moves the HEAD (i.e. the tip of the current branch, if you are on one) to "target" (which has the file in state D).

#5 lore raw

PATCH 3/6 git-reset.txt: reset --soft is not a no-op

In reply to Michael J Gruber

Make it clearer that git reset --soft actually does something (changing HEAD). While it is meantioned in the previous paragraph already it can be easily overlooked otherwise.

---
 Documentation/git-reset.txt |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
Documentation/git-reset.txt +2 -1
index 8fb871c..65f5d07 100644
@@ -43,7 +43,8 @@ linkgit:git-add[1]).
 --
 --soft::
 	Does not touch the index file nor the working tree at all, but
-	requires them to be in a good order. This leaves all your changed
+	requires them to be in good order (and sets the head to <commit>,
+	just like all modes do). This leaves all your changed
 	files "Changes to be committed", as 'git status' would
 	put it.
 
Signature · 1 line
1.7.3.rc1.215.g6997c
#6 lore raw

Re: [PATCH 3/6] git-reset.txt: reset --soft is not a no-op

Quoted 14 lines · Michael J Gruber

Make it clearer that git reset --soft actually does something (changing HEAD). While it is meantioned in the previous paragraph already it can be easily overlooked otherwise.

---
 Documentation/git-reset.txt |    3 ++-

 1 files changed, 2 insertions(+), 1 deletions(-)
Documentation/git-reset.txt +0 -0
index 8fb871c..65f5d07 100644
@@ -43,7 +43,8 @@ linkgit:git-add[1]).
Quoted 8 lines

 --
 --soft::
       Does not touch the index file nor the working tree at all, but
-       requires them to be in a good order. This leaves all your changed
+       requires them to be in good order (and sets the head to <commit>,
+       just like all modes do). This leaves all your changed files "Changes to be committed", as 'git status' would put it.

What does "requires them to be in good order" mean anyway?

j.

#7 lore raw

Re: [PATCH 3/6] git-reset.txt: reset --soft is not a no-op

Quoted 11 lines · Jay Soffian
Quoted 9 lines · Michael J Gruber

Make it clearer that git reset --soft actually does something (changing HEAD). While it is meantioned in the previous paragraph already it can be easily overlooked otherwise.

---
 Documentation/git-reset.txt |    3 ++-

 1 files changed, 2 insertions(+), 1 deletions(-)
Quoted 15 lines
Quoted 5 lines
Documentation/git-reset.txt +0 -0
index 8fb871c..65f5d07 100644
@@ -43,7 +43,8 @@ linkgit:git-add[1]).
Quoted 8 lines

 --
 --soft::
       Does not touch the index file nor the working tree at all, but
-       requires them to be in a good order. This leaves all your changed
+       requires them to be in good order (and sets the head to <commit>,
+       just like all modes do). This leaves all your changed files "Changes to be committed", as 'git status' would put it.

What does "requires them to be in good order" mean anyway?

Good point. I don't think it means anything now; for that matter I do not think it meant anything even back when that sentence was added in f67545e (Docs for git-reset-script., 2005-09-07). A soft reset doesn't even look at the index nor the working tree, so there is no good nor bad order there.

Just remove it.

#8 lore raw

PATCH 4/6 git-reset.txt: use "working tree" consistently

In reply to Michael J Gruber

as per git help glossary

---
 Documentation/git-reset.txt |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)
Documentation/git-reset.txt +7 -7
index 65f5d07..60b4b80 100644
@@ -16,12 +16,12 @@ DESCRIPTION
 -----------
 In the first and second form, copy entries from <commit> to the index.
 In the third form, set the current branch head to <commit>, optionally
-modifying index and worktree to match.  The <commit> defaults to HEAD
+modifying index and working tree to match.  The <commit> defaults to HEAD
 in all forms.
 
 'git reset' [-q] [<commit>] [--] <paths>...::
 	This form resets the index entries for all <paths> to their
-	state at the <commit>.  (It does not affect the worktree, nor
+	state at the <commit>.  (It does not affect the working tree, nor
 	the current branch.)
 +
 This means that `git reset <paths>` is the opposite of `git add
@@ -185,7 +185,7 @@ tip of the current branch in ORIG_HEAD, so resetting hard to it
 brings your index file and the working tree back to that state,
 and resets the tip of the branch to that commit.
 
-Undo a merge or pull inside a dirty work tree::
+Undo a merge or pull inside a dirty working tree::
 +
 ------------
 $ git pull                         <1>
@@ -258,7 +258,7 @@ Suppose you are working on something and you commit it, and then you
 continue working a bit more, but now you think that what you have in
 your working tree should be in another branch that has nothing to do
 with what you committed previously. You can start a new branch and
-reset it while keeping the changes in your work tree.
+reset it while keeping the changes in your working tree.
 +
 ------------
 $ git tag start
@@ -347,11 +347,11 @@ in the index and set HEAD to target (which has the file in state D).
 				--keep   B       C     C
 
 "reset --merge" is meant to be used when resetting out of a conflicted
-merge. Any mergy operation guarantees that the work tree file that is
+merge. Any mergy operation guarantees that the working tree file that is
 involved in the merge does not have local change wrt the index before
-it starts, and that it writes the result out to the work tree. So if
+it starts, and that it writes the result out to the working tree. So if
 we see some difference between the index and the target and also
-between the index and the work tree, then it means that we are not
+between the index and the working tree, then it means that we are not
 resetting out from a state that a mergy operation left after failing
 with a conflict. That is why we disallow --merge option in this case.
 
Signature · 1 line
1.7.3.rc1.215.g6997c
#9 lore raw
In reply to Michael J Gruber
Quoted 8 lines · Michael J Gruber

First of all: I've been out of the loop last week, so please forgive me if this comes at the wrong phase of a cycle.

I portioned the changes to git-reset.txt and ordered them starting from the least controversial, I hope. The descriptions of modes have grown organically over time, and this series tries to make them consistent in structure and wording, after cleaning up some minor issues. 6/6 is the "meat", so to say.

Quoted 4 lines

For the "--merge" description in 6/6: Please double check. I've tried to understand the mode from the tables and from the inner works (git read-tre -u -m plus carrying over unmerged entries) because I did not understand the original description.

My quick read of these changes is that, all around, they are a big improvement to what I find to be one of git's most confusing man pages.

j.

#10 lore raw

PATCH 5/6 git-reset.txt: point to git-checkout

In reply to Michael J Gruber

for the case of updating a file in index and worktree.

---
 Documentation/git-reset.txt |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
Documentation/git-reset.txt +3 -0
index 60b4b80..40e2fd8 100644
@@ -27,6 +27,9 @@ in all forms.
 This means that `git reset <paths>` is the opposite of `git add
 <paths>`.
 
+If you want to reset index entry and working tree state of a file,
+linkgit:git-checkout[1] is your friend.
+
 'git reset' --patch|-p [<commit>] [--] [<paths>...]::
 	Interactively select hunks in the difference between the index
 	and <commit> (defaults to HEAD).  The chosen hunks are applied
Signature · 1 line
1.7.3.rc1.215.g6997c
#11 lore raw

Re: [PATCH 5/6] git-reset.txt: point to git-checkout

Quoted 12 lines · Michael J Gruber

for the case of updating a file in index and worktree.

---
 Documentation/git-reset.txt |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
Documentation/git-reset.txt +0 -0
index 60b4b80..40e2fd8 100644

Documentation/git-reset.txt in all forms. · line 32

Quoted 6 lines
Documentation/git-reset.txt +3 -0
@@ -27,6 +27,9 @@ in all forms.
 This means that `git reset <paths>` is the opposite of `git add
 <paths>`.
 
+If you want to reset index entry and working tree state of a file,
+linkgit:git-checkout[1] is your friend.
+

I am not quite sure if this is an improvement.

You can reset the index entry using git-reset and then check the path out of the index to the working tree using git-checkout, in two separate steps. You can alternatively stuff the contents out of a commit (or more in general any tree-ish) to the index and check it out to the working tree with a single git-checkout. It is obvious to _me_ that you meant to hint the latter in the above, but for people who need that hint it probably isn't. Can we make it clearer? Perhaps...

Using linkgit:git-checkout[1], you can copy the contents of a path out of a commit to the index and to the working tree in one go.

Or if you meant the former,

After running "git reset <paths>" to update the index entry, you can use linkgit:git-checkout[1] to check the contents out of the index to the working tree.

#12 lore raw

PATCH 6/6 git-reset.txt: make modes description more consistent

In reply to Michael J Gruber

Currently, the structure of the individual mode entries is different which makes it difficult to grasp the differences between the modes. Also, the same items are named differently (e.g. <commit>, "the named commit", "the given commit", "the commit being switched to").

Structure and word all mode entries consistently.

---
 Documentation/git-reset.txt |   43 ++++++++++++++++++++++++++-----------------
 1 files changed, 26 insertions(+), 17 deletions(-)
Documentation/git-reset.txt +26 -17
index 40e2fd8..6b60b59 100644
@@ -15,13 +15,13 @@ SYNOPSIS
 DESCRIPTION
 -----------
 In the first and second form, copy entries from <commit> to the index.
-In the third form, set the current branch head to <commit>, optionally
+In the third form, set the current branch head (HEAD) to <commit>, optionally
 modifying index and working tree to match.  The <commit> defaults to HEAD
 in all forms.
 
 'git reset' [-q] [<commit>] [--] <paths>...::
 	This form resets the index entries for all <paths> to their
-	state at the <commit>.  (It does not affect the working tree, nor
+	state at <commit>.  (It does not affect the working tree, nor
 	the current branch.)
 +
 This means that `git reset <paths>` is the opposite of `git add
@@ -39,9 +39,10 @@ This means that `git reset -p` is the opposite of `git add -p` (see
 linkgit:git-add[1]).
 
 'git reset' [--<mode>] [<commit>]::
-	This form sets the current branch head to <commit> and then
-	updates index and working tree according to <mode>, which must
-	be one of the following:
+	This form sets the current branch head to <commit> and
+	possibly updates the index (resetting it to the tree of <commit>) and
+	the working tree depending on <mode>, which
+	must be one of the following:
 +
 --
 --soft::
@@ -57,22 +58,30 @@ linkgit:git-add[1]).
 	been updated. This is the default action.
 
 --hard::
-	Matches the working tree and index to that of the tree being
-	switched to. Any changes to tracked files in the working tree
-	since <commit> are lost.
+	Resets the index and working tree. Any changes to tracked files in the
+	working tree since <commit> are lost.
 
 --merge::
-	Resets the index to match the tree recorded by the named commit,
-	and updates the files that are different between the named commit
-	and the current commit in the working tree.
+	Resets the index and updates the files in the working tree that are
+	different between <commit> and HEAD, but keeps those which are
+	different between the index and working tree (i.e. which have unstaged
+	changes).
+	If a file that is different between <commit> and the index has unstaged
+	changes, reset is aborted.
++
+In other words, --merge does something like a 'git read-tree -u -m <commit>',
+but carries forward unmerged index entries.
 
 --keep::
-	Reset the index to the given commit, keeping local changes in
-	the working tree since the current commit, while updating
-	working tree files without local changes to what appears in
-	the given commit.  If a file that is different between the
-	current commit and the given commit has local changes, reset
-	is aborted.
+	Resets the index, updates files in the working tree that are
+	different between <commit> and HEAD, but keeps those
+	which are different between HEAD and the working tree (i.e.
+	which have local changes).
+	If a file that is different between <commit> and HEAD has local changes,
+	reset is aborted.
++
+In other words, --keep does a 2-way merge between <commit> and HEAD followed by
+'git reset --mixed <commit>'.
 --
 
 If you want to undo a commit other than the latest on a branch,
Signature · 1 line
1.7.3.rc1.215.g6997c
#13 lore raw

Re: [PATCH 6/6] git-reset.txt: make modes description more consistent

Documentation/git-reset.txt SYNOPSIS · line 20

Quoted 12 lines · Michael J Gruber
Documentation/git-reset.txt +1 -1
index 40e2fd8..6b60b59 100644
@@ -15,13 +15,13 @@ SYNOPSIS
 DESCRIPTION
 -----------
 In the first and second form, copy entries from <commit> to the index.
-In the third form, set the current branch head to <commit>, optionally
+In the third form, set the current branch head (HEAD) to <commit>, optionally
 modifying index and working tree to match.  The <commit> defaults to HEAD
 in all forms.

In the documentation (not limited to "git reset"), we say "update HEAD" and expect the reader to understand that (1) when HEAD is not detached, that updates what commit the current branch points at, (2) when HEAD is detached, no branch is affected.

But that is asking too much to newcomers who weren't around before we introduced detached HEAD around 1.5.0 timeframe. This documentation glitch is there primarily because the detached HEAD came much later than all the "updates the branch" concepts were codified and documented for many commands that advance/modify history, e.g. reset, commit, merge, etc.

We should rectify this, and I think this series is going in the right direction.

Documentation/git-reset.txt This means that `git reset -p` is the opposite of `git add -p` (see · line 45

Quoted 11 lines
Documentation/git-reset.txt +4 -3
@@ -39,9 +39,10 @@ This means that `git reset -p` is the opposite of `git add -p` (see
 linkgit:git-add[1]).
 
 'git reset' [--<mode>] [<commit>]::
-	This form sets the current branch head to <commit> and then
-	updates index and working tree according to <mode>, which must
-	be one of the following:
+	This form sets the current branch head to <commit> and
+	possibly updates the index (resetting it to the tree of <commit>) and
+	the working tree depending on <mode>, which
+	must be one of the following:

Nice.

Documentation/git-reset.txt linkgit:git-add[1]). · line 62

Quoted 9 lines
Documentation/git-reset.txt +2 -3
@@ -57,22 +58,30 @@ linkgit:git-add[1]).
 	been updated. This is the default action.
 
 --hard::
-	Matches the working tree and index to that of the tree being
-	switched to. Any changes to tracked files in the working tree
-	since <commit> are lost.
+	Resets the index and working tree. Any changes to tracked files in the
+	working tree since <commit> are lost.

Explaining what "reset" does using the undefined word "reset" smells somewhat wrong. Not that "matches" is any better, but at least the original says "to that of the tree", which you seem to have lost, so there is no indication what they are reset _to_. I don't think the above is a good change for this reason.

I also would prefer "are discarded" over "are lost". It is a conscious decision to use "git reset --hard" by the user in order to _do_ something, and "discard" is probably more accurate, in the sense that you use the command because you want to throw it away, than "lose" which implies you might have wanted to keep but did something wrong.

Documentation/git-reset.txt linkgit:git-add[1]). · line 70

Quoted 10 lines
Documentation/git-reset.txt +6 -3
 --merge::
-	Resets the index to match the tree recorded by the named commit,
-	and updates the files that are different between the named commit
-	and the current commit in the working tree.
+	Resets the index and updates the files in the working tree that are
+	different between <commit> and HEAD, but keeps those which are
+	different between the index and working tree (i.e. which have unstaged
+	changes).
+	If a file that is different between <commit> and the index has unstaged
+	changes, reset is aborted.

It may be just me, but "unstaged" sounds as if you once have staged and then changed your mind and took it back. "... which have changes that haven't been added" might be clearer.

Again, it is made unclear what these entities are _reset to_ with the above change. Same comments apply for your change to --keep.

#14 lore raw

Re: [PATCH 6/6] git-reset.txt: make modes description more consistent

Thanks for all your hints and thoughts. I'll be sending a v2 in a minute. There's just one point where I chose not to follow completely for now:

Junio C Hamano venit, vidit, dixit 14.09.2010 02:35:

Quoted 1 line

Michael J Gruber <[email protected]> writes:

[snip]

Quoted 15 lines

Documentation/git-reset.txt linkgit:git-add[1]). · line 62

Quoted 9 lines
Documentation/git-reset.txt +2 -3
@@ -57,22 +58,30 @@ linkgit:git-add[1]).
 	been updated. This is the default action.
 
 --hard::
-	Matches the working tree and index to that of the tree being
-	switched to. Any changes to tracked files in the working tree
-	since <commit> are lost.
+	Resets the index and working tree. Any changes to tracked files in the
+	working tree since <commit> are lost.

Explaining what "reset" does using the undefined word "reset" smells somewhat wrong. Not that "matches" is any better, but at least the original says "to that of the tree", which you seem to have lost, so there is no indication what they are reset _to_. I don't think the above is a good change for this reason.

The idea was to define "reset" once (in the paragraph right before the list of modes) and then use it without repeating that. I tried to make this a bit clearer now by emphasising the term "reset" more in the leading paragraph.

[snip]

Quoted 3 lines

It may be just me, but "unstaged" sounds as if you once have staged and then changed your mind and took it back. "... which have changes that haven't been added" might be clearer.

We use "unstaged" in the meaning of "not staged/added yet" in other places, as well - but in surprisingly few I have to admit! I went with your version here.

Michael

#15 lore raw

PATCH v2 1/6 git-reset.txt: clarify branch vs. branch head

In reply to Michael J Gruber

"Change the branch" can be misunderstood to mean "change which branch is checked out". Make it clearer that git-reset changes the branch head of the currently checked out branch.

---
 Documentation/git-reset.txt |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
Documentation/git-reset.txt +2 -2
index 9cf3148..91bd2e9 100644
@@ -15,7 +15,7 @@ SYNOPSIS
 DESCRIPTION
 -----------
 In the first and second form, copy entries from <commit> to the index.
-In the third form, set the current branch to <commit>, optionally
+In the third form, set the current branch head to <commit>, optionally
 modifying index and worktree to match.  The <commit> defaults to HEAD
 in all forms.
 
@@ -36,7 +36,7 @@ This means that `git reset -p` is the opposite of `git add -p` (see
 linkgit:git-add[1]).
 
 'git reset' [--<mode>] [<commit>]::
-	This form points the current branch to <commit> and then
+	This form resets the current branch head to <commit> and then
 	updates index and working tree according to <mode>, which must
 	be one of the following:
 +
Signature · 1 line
1.7.3.rc1.215.g6997c
#16 lore raw

PATCH v2 2/6 git-reset.txt: reset does not change files in target

In reply to Michael J Gruber

git-reset obviously cannot change files in an existing commit. Make it not sound as if it could: reset can change HEAD and, in that sense, can change which state a file in HEAD is in.

---
 Documentation/git-reset.txt |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
Documentation/git-reset.txt +4 -2
index 91bd2e9..e443740 100644
@@ -294,8 +294,10 @@ In these tables, A, B, C and D are some different states of a
 file. For example, the first line of the first table means that if a
 file is in state A in the working tree, in state B in the index, in
 state C in HEAD and in state D in the target, then "git reset --soft
-target" will put the file in state A in the working tree, in state B
-in the index and in state D in HEAD.
+target" will leave the file in the working tree in state A and in the
+index in state B.  It resets (i.e. moves) the HEAD (i.e. the tip of
+the current branch, if you are on one) to "target" (which has the file
+in state D).
 
       working index HEAD target         working index HEAD
       ----------------------------------------------------
Signature · 1 line
1.7.3.rc1.215.g6997c
#17 lore raw

PATCH v2 3/6 git-reset.txt: reset --soft is not a no-op

In reply to Michael J Gruber

Make it clearer that git reset --soft actually does something (changing HEAD). While it is mentioned in the previous paragraph already it can be easily overlooked otherwise.

Also, git reset --soft does not look at the index nor the worktree, so there is no "good order" requirement.

---
 Documentation/git-reset.txt |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
Documentation/git-reset.txt +4 -4
index e443740..8762a0c 100644
@@ -42,10 +42,10 @@ linkgit:git-add[1]).
 +
 --
 --soft::
-	Does not touch the index file nor the working tree at all, but
-	requires them to be in a good order. This leaves all your changed
-	files "Changes to be committed", as 'git status' would
-	put it.
+	Does not touch the index file nor the working tree at all (but
+	resets the head to <commit>, just like all modes do). This leaves
+	all your changed files "Changes to be committed", as 'git status'
+	would put it.
 
 --mixed::
 	Resets the index but not the working tree (i.e., the changed files
Signature · 1 line
1.7.3.rc1.215.g6997c
#18 lore raw

PATCH v2 4/6 git-reset.txt: use "working tree" consistently

In reply to Michael J Gruber

as per git help glossary

---
 Documentation/git-reset.txt |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)
Documentation/git-reset.txt +7 -7
index 8762a0c..6c94f83 100644
@@ -16,12 +16,12 @@ DESCRIPTION
 -----------
 In the first and second form, copy entries from <commit> to the index.
 In the third form, set the current branch head to <commit>, optionally
-modifying index and worktree to match.  The <commit> defaults to HEAD
+modifying index and working tree to match.  The <commit> defaults to HEAD
 in all forms.
 
 'git reset' [-q] [<commit>] [--] <paths>...::
 	This form resets the index entries for all <paths> to their
-	state at the <commit>.  (It does not affect the worktree, nor
+	state at the <commit>.  (It does not affect the working tree, nor
 	the current branch.)
 +
 This means that `git reset <paths>` is the opposite of `git add
@@ -184,7 +184,7 @@ tip of the current branch in ORIG_HEAD, so resetting hard to it
 brings your index file and the working tree back to that state,
 and resets the tip of the branch to that commit.
 
-Undo a merge or pull inside a dirty work tree::
+Undo a merge or pull inside a dirty working tree::
 +
 ------------
 $ git pull                         <1>
@@ -257,7 +257,7 @@ Suppose you are working on something and you commit it, and then you
 continue working a bit more, but now you think that what you have in
 your working tree should be in another branch that has nothing to do
 with what you committed previously. You can start a new branch and
-reset it while keeping the changes in your work tree.
+reset it while keeping the changes in your working tree.
 +
 ------------
 $ git tag start
@@ -348,11 +348,11 @@ in state D).
 				--keep   B       C     C
 
 "reset --merge" is meant to be used when resetting out of a conflicted
-merge. Any mergy operation guarantees that the work tree file that is
+merge. Any mergy operation guarantees that the working tree file that is
 involved in the merge does not have local change wrt the index before
-it starts, and that it writes the result out to the work tree. So if
+it starts, and that it writes the result out to the working tree. So if
 we see some difference between the index and the target and also
-between the index and the work tree, then it means that we are not
+between the index and the working tree, then it means that we are not
 resetting out from a state that a mergy operation left after failing
 with a conflict. That is why we disallow --merge option in this case.
 
Signature · 1 line
1.7.3.rc1.215.g6997c
#19 lore raw

v2 cover git-reset.txt improvements

In reply to Michael J Gruber

In v2 I tried to incorporate all changes as suggested by Junio. Thanks for all the hints!

Michael J Gruber (6):
git-reset.txt: clarify branch vs. branch head git-reset.txt: reset does not change files in target git-reset.txt: reset --soft is not a no-op git-reset.txt: use "working tree" consistently git-reset.txt: point to git-checkout git-reset.txt: make modes description more consistent

 Documentation/git-reset.txt |   76 ++++++++++++++++++++++++++----------------
 1 files changed, 47 insertions(+), 29 deletions(-)
Signature · 1 line
1.7.3.rc1.215.g6997c
#20 lore raw

PATCH v2 5/6 git-reset.txt: point to git-checkout

In reply to Michael J Gruber

for the case of updating a file in index and worktree, or from the index to the worktree.

---
 Documentation/git-reset.txt |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
Documentation/git-reset.txt +7 -0
index 6c94f83..78f3b74 100644
@@ -26,6 +26,13 @@ in all forms.
 +
 This means that `git reset <paths>` is the opposite of `git add
 <paths>`.
++
+After running `git reset <paths>` to update the index entry, you can
+use linkgit:git-checkout[1] to check the contents out of the index to
+the working tree.
+Alternatively, using linkgit:git-checkout[1] and specifying a commit, you
+can copy the contents of a path out of a commit to the index and to the
+working tree in one go.
 
 'git reset' --patch|-p [<commit>] [--] [<paths>...]::
 	Interactively select hunks in the difference between the index
Signature · 1 line
1.7.3.rc1.215.g6997c
#21 lore raw

PATCH v2 6/6 git-reset.txt: make modes description more consistent

In reply to Michael J Gruber

Currently, the structure of the individual mode entries is different which makes it difficult to grasp the differences between the modes. Also, the same items are named differently (e.g. <commit>, "the named commit", "the given commit", "the commit being switched to").

Structure and word all mode entries consistently.

Conflicts:

Documentation/git-reset.txt

---
 Documentation/git-reset.txt |   43 ++++++++++++++++++++++++++-----------------
 1 files changed, 26 insertions(+), 17 deletions(-)
Documentation/git-reset.txt +26 -17
index 78f3b74..fd72976 100644
@@ -15,13 +15,13 @@ SYNOPSIS
 DESCRIPTION
 -----------
 In the first and second form, copy entries from <commit> to the index.
-In the third form, set the current branch head to <commit>, optionally
+In the third form, set the current branch head (HEAD) to <commit>, optionally
 modifying index and working tree to match.  The <commit> defaults to HEAD
 in all forms.
 
 'git reset' [-q] [<commit>] [--] <paths>...::
 	This form resets the index entries for all <paths> to their
-	state at the <commit>.  (It does not affect the working tree, nor
+	state at <commit>.  (It does not affect the working tree, nor
 	the current branch.)
 +
 This means that `git reset <paths>` is the opposite of `git add
@@ -43,9 +43,10 @@ This means that `git reset -p` is the opposite of `git add -p` (see
 linkgit:git-add[1]).
 
 'git reset' [--<mode>] [<commit>]::
-	This form resets the current branch head to <commit> and then
-	updates index and working tree according to <mode>, which must
-	be one of the following:
+	This form resets the current branch head to <commit> and
+	possibly updates the index (resetting it to the tree of <commit>) and
+	the working tree depending on <mode>, which
+	must be one of the following:
 +
 --
 --soft::
@@ -60,22 +61,30 @@ linkgit:git-add[1]).
 	been updated. This is the default action.
 
 --hard::
-	Matches the working tree and index to that of the tree being
-	switched to. Any changes to tracked files in the working tree
-	since <commit> are lost.
+	Resets the index and working tree. Any changes to tracked files in the
+	working tree since <commit> are discarded.
 
 --merge::
-	Resets the index to match the tree recorded by the named commit,
-	and updates the files that are different between the named commit
-	and the current commit in the working tree.
+	Resets the index and updates the files in the working tree that are
+	different between <commit> and HEAD, but keeps those which are
+	different between the index and working tree (i.e. which have changes
+	which have not been added).
+	If a file that is different between <commit> and the index has unstaged
+	changes, reset is aborted.
++
+In other words, --merge does something like a 'git read-tree -u -m <commit>',
+but carries forward unmerged index entries.
 
 --keep::
-	Reset the index to the given commit, keeping local changes in
-	the working tree since the current commit, while updating
-	working tree files without local changes to what appears in
-	the given commit.  If a file that is different between the
-	current commit and the given commit has local changes, reset
-	is aborted.
+	Resets the index, updates files in the working tree that are
+	different between <commit> and HEAD, but keeps those
+	which are different between HEAD and the working tree (i.e.
+	which have local changes).
+	If a file that is different between <commit> and HEAD has local changes,
+	reset is aborted.
++
+In other words, --keep does a 2-way merge between <commit> and HEAD followed by
+'git reset --mixed <commit>'.
 --
 
 If you want to undo a commit other than the latest on a branch,
Signature · 1 line
1.7.3.rc1.215.g6997c