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

[PATCH 1/2] Documentation/git-checkout.txt: clarify usage

From
Chris Rorvick <chris@rorvick.com>
Date
Dec 17, 2012, 06:45 UTC
Message-ID
<1355726702-27974-2-git-send-email-chris@rorvick.com>
In-Reply-To
<1355726702-27974-1-git-send-email-chris@rorvick.com>

The forms of checkout that do not take a path are lumped together in the DESCRIPTION section, but the description for this group is dominated by explanation of the -b|-B form. Split these apart for more clarity.

Signed-off-by: Chris Rorvick <chris@rorvick.com>
---
 Documentation/git-checkout.txt | 26 +++++++++++++++++---------
 1 file changed, 17 insertions(+), 9 deletions(-)
diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt
index 7958a47..a47555c 100644
--- a/Documentation/git-checkout.txt
+++ b/Documentation/git-checkout.txt
@@ -22,17 +22,18 @@ also update `HEAD` to set the specified branch as the current
 branch.
 
 'git checkout' [<branch>]::
+
+	Update the index, working tree, and HEAD to reflect the
+	specified branch.
+
 'git checkout' -b|-B <new_branch> [<start point>]::
-'git checkout' [--detach] [<commit>]::
 
-	This form switches branches by updating the index, working
-	tree, and HEAD to reflect the specified branch or commit.
-+
-If `-b` is given, a new branch is created as if linkgit:git-branch[1]
-were called and then checked out; in this case you can
-use the `--track` or `--no-track` options, which will be passed to
-'git branch'.  As a convenience, `--track` without `-b` implies branch
-creation; see the description of `--track` below.
+	Specifying `-b` causes a new branch to be created as if
+	linkgit:git-branch[1] were called and then checked out.  In
+	this case you can use the `--track` or `--no-track` options,
+	which will be passed to 'git branch'.  As a convenience,
+	`--track` without `-b` implies branch creation; see the
+	description of `--track` below.
 +
 If `-B` is given, <new_branch> is created if it doesn't exist; otherwise, it
 is reset. This is the transactional equivalent of
@@ -45,6 +46,13 @@ $ git checkout <branch>
 that is to say, the branch is not reset/created unless "git checkout" is
 successful.
 
+'git checkout' [--detach] [<commit>]::
+
+	Update the index and working tree to reflect the specified
+	commit and set HEAD to point directly to <commit> (see
+	"DETACHED HEAD" section.)  Passing `--detach` forces this
+	behavior even if <commit> is a branch.
+
 'git checkout' [-p|--patch] [<tree-ish>] [--] <pathspec>...::
 
 	When <paths> or `--patch` are given, 'git checkout' does *not*
-- 
1.8.1.rc1.203.g1ddc124
Previous: Chris RorvickNext: Junio C Hamano
Message 2 of 23 in “Documentation: clarify usage of checkout”
  1. 0/2 Documentation: clarify usage of checkoutChris Rorvick, Dec 17, 2012
  2. 1/2 Documentation/git-checkout.txt: clarify usageChris Rorvick, Dec 17, 2012
  3. Junio C HamanoDec 17, 2012
  4. Johannes SixtDec 17, 2012
  5. Junio C HamanoDec 17, 2012
  6. Johannes SixtDec 17, 2012
  7. Junio C HamanoDec 17, 2012
  8. Andrew ArdillDec 17, 2012
  9. Chris RorvickDec 18, 2012
  10. Philip OakleyDec 17, 2012
  11. Junio C HamanoDec 17, 2012
  12. Andrew ArdillDec 17, 2012
  13. Junio C HamanoDec 17, 2012
  14. Andrew ArdillDec 18, 2012
  15. Junio C HamanoDec 18, 2012
  16. Andrew ArdillDec 18, 2012
  17. Chris RorvickDec 18, 2012
  18. Junio C HamanoDec 18, 2012
  19. Philip OakleyDec 17, 2012
  20. 2/2 Documentation/git-checkout.txt: document 70c9ac2 behaviorChris Rorvick, Dec 17, 2012
  21. Junio C HamanoDec 17, 2012
  22. Andrew ArdillDec 17, 2012
  23. Junio C HamanoDec 17, 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.