git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Michael J Gruber <git@drmicha.warpmail.net>
Date
Sep 13, 2010, 08:06 UTC
Message-ID
<d4a048c1cfd39a2d7ab8a86554bb48937629620c.1284365021.git.git@drmicha.warpmail.net>
In-Reply-To
<cover.1284365021.git.git@drmicha.warpmail.net>

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.
Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
---
 Documentation/git-reset.txt |   43 ++++++++++++++++++++++++++-----------------
 1 files changed, 26 insertions(+), 17 deletions(-)
diff --git a/Documentation/git-reset.txt b/Documentation/git-reset.txt
index 40e2fd8..6b60b59 100644
--- a/Documentation/git-reset.txt
+++ b/Documentation/git-reset.txt
@@ -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,
-- 
1.7.3.rc1.215.g6997c
Previous: Junio C HamanoNext: Junio C Hamano
Message 12 of 22 in “git-reset.txt improvements”
  1. 0/6 git-reset.txt improvementsMichael J Gruber, Sep 13, 2010
  2. 1/6 git-reset.txt: clarify branch vs. branch headMichael J Gruber, Sep 13, 2010
  3. Junio C HamanoSep 14, 2010
  4. 2/6 git-reset.txt: reset does not change files in targetMichael J Gruber, Sep 13, 2010
  5. Junio C HamanoSep 14, 2010
  6. 3/6 git-reset.txt: reset --soft is not a no-opMichael J Gruber, Sep 13, 2010
  7. Jay SoffianSep 13, 2010
  8. Junio C HamanoSep 13, 2010
  9. 4/6 git-reset.txt: use "working tree" consistentlyMichael J Gruber, Sep 13, 2010
  10. 5/6 git-reset.txt: point to git-checkoutMichael J Gruber, Sep 13, 2010
  11. Junio C HamanoSep 14, 2010
  12. 6/6 git-reset.txt: make modes description more consistentMichael J Gruber, Sep 13, 2010
  13. Junio C HamanoSep 14, 2010
  14. Michael J GruberSep 15, 2010
  15. Jay SoffianSep 13, 2010
  16. 0/6 git-reset.txt improvementsMichael J Gruber, Sep 15, 2010
  17. 1/6 git-reset.txt: clarify branch vs. branch headMichael J Gruber, Sep 15, 2010
  18. 2/6 git-reset.txt: reset does not change files in targetMichael J Gruber, Sep 15, 2010
  19. 3/6 git-reset.txt: reset --soft is not a no-opMichael J Gruber, Sep 15, 2010
  20. 4/6 git-reset.txt: use "working tree" consistentlyMichael J Gruber, Sep 15, 2010
  21. 5/6 git-reset.txt: point to git-checkoutMichael J Gruber, Sep 15, 2010
  22. 6/6 git-reset.txt: make modes description more consistentMichael J Gruber, Sep 15, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.