[PATCH 0/2] Documentation: clarify usage of checkout

DORMANTno replies

3 messages, 1 author, 2016-06-15 · open the first message on its own page

[PATCH 0/2] Documentation: clarify usage of checkout

From: Chris Rorvick <hidden>
Date: 2016-06-15 22:55:32

This is response to the questions posed in:

  http://thread.gmane.org/gmane.comp.version-control.git/211624

It doesn't seem like the behavior implemented in 70c9ac2 is documented.

Chris Rorvick (2):
  Documentation/git-checkout.txt: clarify usage
  Documentation/git-checkout.txt: document 70c9ac2 behavior

 Documentation/git-checkout.txt | 34 +++++++++++++++++++++++++---------
 1 file changed, 25 insertions(+), 9 deletions(-)

-- 
1.8.1.rc1.203.g1ddc124

[PATCH 2/2] Documentation/git-checkout.txt: document 70c9ac2 behavior

From: Chris Rorvick <hidden>
Date: 2016-06-15 22:55:32

Document the behavior implemented in 70c9ac2 (DWIM "git checkout
frotz" to "git checkout -b frotz origin/frotz").

Signed-off-by: Chris Rorvick <redacted>
---
 Documentation/git-checkout.txt | 8 ++++++++
 1 file changed, 8 insertions(+)
diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt
index a47555c..db89cf7 100644
--- a/Documentation/git-checkout.txt
+++ b/Documentation/git-checkout.txt
@@ -25,6 +25,14 @@ branch.
 
 	Update the index, working tree, and HEAD to reflect the
 	specified branch.
++
+If <branch> is not found but there does exist a tracking branch in
+exactly one remote (call it <remote>) with a matching name, treat as
+equivalent to
++
+------------
+$ git checkout -b <branch> --track <remote>/<branch>
+------------
 
 'git checkout' -b|-B <new_branch> [<start point>]::
 
-- 
1.8.1.rc1.203.g1ddc124

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

From: Chris Rorvick <hidden>
Date: 2016-06-15 22:55:32

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 <redacted>
---
 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help