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

Re: Mistake in git-reset documentation

From
KMKrzysztof Mazur <krzysiek@podlesie.net>
Date
Oct 28, 2012, 14:13 UTC
Message-ID
<20121028141327.GB16686@shrek.podlesie.net>
In-Reply-To
<20121028134635.GA25519@sigill.intra.peff.net>
On Sun, Oct 28, 2012 at 09:46:35AM -0400, Jeff King wrote:
Show 26 quoted lines
> On Sun, Oct 28, 2012 at 02:39:49PM +0100, Andreas Schwab wrote:
> 
> > Jeff King <peff@peff.net> writes:
> > 
> > > On Sun, Oct 28, 2012 at 09:36:10AM +0100, Krzysztof Mazur wrote:
> > >
> > >>  DESCRIPTION
> > >>  -----------
> > >> @@ -43,7 +43,7 @@ This means that `git reset -p` is the opposite of `git add -p`, i.e.
> > >>  you can use it to selectively reset hunks. See the ``Interactive Mode''
> > >>  section of linkgit:git-add[1] to learn how to operate the `--patch` mode.
> > >>  
> > >> -'git reset' --<mode> [<commit>]::
> > >> +'git reset' [--<mode>] [<commit>]::
> > >>  	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
> > >
> > > Should we say something like "if --<mode> is omitted, defaults to
> > > "--mixed"?
> > 
> > Under --mixed it already says "This is the default action", though.
> 
> I know, but that is somewhat buried for somebody who is seeing that the
> "--<mode>" bit is optional and wondering what it means to omit it.
> 

The --mixed mode is also described as second mode, and saying that --mixed is default earlier may save some time wasted on reading --soft description.

There is also small inconsequence in what <mode> is, just "mixed" or "--mixed".

Krzysiek
-- >8 --
Subject: [PATCH] doc: git-reset: make "<mode>" optional

The git-reset's "<mode>" is an optional argument, however it was documented as required.

The "<mode>" is documented as one of: --soft, --mixed, --hard, --merge or --keep, so "<mode>" should be used instead of "--<mode>".

Signed-off-by: Krzysztof Mazur <krzysiek@podlesie.net>
---
 Documentation/git-reset.txt | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/Documentation/git-reset.txt b/Documentation/git-reset.txt
index 117e374..978d8da 100644
--- a/Documentation/git-reset.txt
+++ b/Documentation/git-reset.txt
@@ -10,7 +10,7 @@ SYNOPSIS
 [verse]
 'git reset' [-q] [<commit>] [--] <paths>...
 'git reset' (--patch | -p) [<commit>] [--] [<paths>...]
-'git reset' (--soft | --mixed | --hard | --merge | --keep) [-q] [<commit>]
+'git reset' [--soft | --mixed | --hard | --merge | --keep] [-q] [<commit>]
 
 DESCRIPTION
 -----------
@@ -43,11 +43,11 @@ This means that `git reset -p` is the opposite of `git add -p`, i.e.
 you can use it to selectively reset hunks. See the ``Interactive Mode''
 section of linkgit:git-add[1] to learn how to operate the `--patch` mode.
 
-'git reset' --<mode> [<commit>]::
+'git reset' [<mode>] [<commit>]::
 	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:
+	the working tree depending on <mode>. If <mode> is omitted,
+	defaults to "--mixed". The <mode> must be one of the following:
 +
 --
 --soft::
-- 
1.8.0.47.g5b520ba
Previous: Jeff KingNext: Jeff King
Message 7 of 8 in “Mistake in git-reset documentation”
  1. Bojan PetrovićOct 27, 2012
  2. Krzysztof MazurOct 28, 2012
  3. Bojan PetrovićOct 28, 2012
  4. Jeff KingOct 28, 2012
  5. Andreas SchwabOct 28, 2012
  6. Jeff KingOct 28, 2012
  7. Krzysztof MazurOct 28, 2012
  8. Jeff KingOct 29, 2012

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.