# [PATCH 2/2] git-checkout.txt: clarify that <branch> applies when no path is given.

6 messages from 2009-04-06 to 2009-04-07. Participants: Matthieu Moy, Junio C Hamano, Mike Ralphson.
Thread: https://gitlist.dev/t/18755

## Matthieu Moy, 2009-04-06 20:45

Subject: [PATCH 1/2] git-checkout.txt: fix incorrect statement about HEAD and index
Message-ID: <1239050722-1227-1-git-send-email-Matthieu.Moy@imag.fr>
URL: https://gitlist.dev/e/1239050722-1227-1-git-send-email-Matthieu.Moy%40imag.fr

```
The command "git checkout" checks out from the index by default, not
HEAD (the introducing comment were correct, but the detailled
explanation added below were not).

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
---
 Documentation/git-checkout.txt |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt
index 1a6c19e..0b5485b 100644
--- a/Documentation/git-checkout.txt
+++ b/Documentation/git-checkout.txt
@@ -191,7 +191,7 @@ $ git checkout hello.c            <3>
 +
 <1> switch branch
 <2> take a file out of another commit
-<3> restore hello.c from HEAD of current branch
+<3> restore hello.c from the index
 +
 If you have an unfortunate branch that is named `hello.c`, this
 step would be confused as an instruction to switch to that branch.
-- 
1.6.2.1.427.g061ea

```

## Matthieu Moy, 2009-04-06 20:45

Subject: [PATCH 2/2] git-checkout.txt: clarify that <branch> applies when no path is given.
Message-ID: <1239050722-1227-2-git-send-email-Matthieu.Moy@imag.fr>
URL: https://gitlist.dev/e/1239050722-1227-2-git-send-email-Matthieu.Moy%40imag.fr
In-Reply-To: <1239050722-1227-1-git-send-email-Matthieu.Moy@imag.fr>

```
Otherwise, the sentence "Defaults to HEAD." can be mis-read to mean
that "git checkout -- hello.c" checks-out from HEAD.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
---

This may be a bit too verbose, but I've been biten by this (reading
the doc not carrefully enough, I really thought git checkout would
take HEAD, then I thought it was actually a documentation bug, and
then I realized I miss-read). This patch would have saved me time. But
if other disagree, I won't fight ;-).

 Documentation/git-checkout.txt |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt
index 0b5485b..58bf508 100644
--- a/Documentation/git-checkout.txt
+++ b/Documentation/git-checkout.txt
@@ -126,9 +126,14 @@ the conflicted merge in the specified paths.
 <new_branch>::
 	Name for the new branch.
 
+<tree-ish>::
+	Tree to checkout from (when path are given). If not specified,
+	the index will be used.
+
 <branch>::
-	Branch to checkout; may be any object ID that resolves to a
-	commit.  Defaults to HEAD.
+	Branch to checkout (when no path are given); may be any object
+	ID that resolves to a commit.  Defaults to HEAD.
+
 +
 When this parameter names a non-branch (but still a valid commit object),
 your HEAD becomes 'detached'.
-- 
1.6.2.1.427.g061ea

```

## Junio C Hamano, 2009-04-07 01:08

Subject: Re: [PATCH 1/2] git-checkout.txt: fix incorrect statement about HEAD and index
Message-ID: <7v4ox146f3.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7v4ox146f3.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <1239050722-1227-1-git-send-email-Matthieu.Moy@imag.fr>

```
Thanks.  Both patches look good.

```

## Mike Ralphson, 2009-04-07 09:41

Subject: Re: [PATCH 2/2] git-checkout.txt: clarify that <branch> applies when no path is given.
Message-ID: <e2b179460904070241y493ef876xc628d35b606e4032@mail.gmail.com>
URL: https://gitlist.dev/e/e2b179460904070241y493ef876xc628d35b606e4032%40mail.gmail.com
In-Reply-To: <1239050722-1227-2-git-send-email-Matthieu.Moy@imag.fr>

```
2009/4/6 Matthieu Moy <Matthieu.Moy@imag.fr>:
> Otherwise, the sentence "Defaults to HEAD." can be mis-read to mean
> that "git checkout -- hello.c" checks-out from HEAD.

> diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt
> index 0b5485b..58bf508 100644
> --- a/Documentation/git-checkout.txt
> +++ b/Documentation/git-checkout.txt
> @@ -126,9 +126,14 @@ the conflicted merge in the specified paths.
>  <new_branch>::
>        Name for the new branch.
>
> +<tree-ish>::
> +       Tree to checkout from (when path are given). If not specified,
> +       the index will be used.
> +
>  <branch>::
> -       Branch to checkout; may be any object ID that resolves to a
> -       commit.  Defaults to HEAD.
> +       Branch to checkout (when no path are given); may be any object
> +       ID that resolves to a commit.  Defaults to HEAD.
> +

s/path are/paths are/g

Sorry if I come across as picking on your grammar, I think your
documentation improvements are very worthwhile.

Mike

```

## Matthieu Moy, 2009-04-07 10:20

Subject: [PATCH 1/2] git-checkout.txt: clarify that <branch> applies when no path is given.
Message-ID: <1239099643-11959-1-git-send-email-Matthieu.Moy@imag.fr>
URL: https://gitlist.dev/e/1239099643-11959-1-git-send-email-Matthieu.Moy%40imag.fr
In-Reply-To: <e2b179460904070241y493ef876xc628d35b606e4032@mail.gmail.com>

```
Otherwise, the sentence "Defaults to HEAD." can be mis-read to mean
that "git checkout -- hello.c" checks-out from HEAD.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
---
> s/path are/paths are/g

Right.

I'm not 100% sure about "no paths are given" Vs "no path is given",
but my understanding of english grammar is that since there could have
been several paths, the absence of path is still plural (French would
be singular here).

> Sorry if I come across as picking on your grammar, I think your
> documentation improvements are very worthwhile.

No harm ;-).

 Documentation/git-checkout.txt |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt
index 0b5485b..7eafcdf 100644
--- a/Documentation/git-checkout.txt
+++ b/Documentation/git-checkout.txt
@@ -126,9 +126,14 @@ the conflicted merge in the specified paths.
 <new_branch>::
 	Name for the new branch.
 
+<tree-ish>::
+	Tree to checkout from (when paths are given). If not specified,
+	the index will be used.
+
 <branch>::
-	Branch to checkout; may be any object ID that resolves to a
-	commit.  Defaults to HEAD.
+	Branch to checkout (when no paths are given); may be any object
+	ID that resolves to a commit.  Defaults to HEAD.
+
 +
 When this parameter names a non-branch (but still a valid commit object),
 your HEAD becomes 'detached'.
-- 
1.6.2.2.449.g92961.dirty

```

## Matthieu Moy, 2009-04-07 12:43

Subject: [PATCH v2] git-checkout.txt: clarify that <branch> applies when no path is given.
Message-ID: <1239108233-20924-1-git-send-email-Matthieu.Moy@imag.fr>
URL: https://gitlist.dev/e/1239108233-20924-1-git-send-email-Matthieu.Moy%40imag.fr
In-Reply-To: <1239099643-11959-1-git-send-email-Matthieu.Moy@imag.fr>

```
Otherwise, the sentence "Defaults to HEAD." can be mis-read to mean
that "git checkout -- hello.c" checks-out from HEAD.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
---
Sorry, patch v1 was introducing a spurious newline, which broke
asciidoc syntax. This fixes it, but Junio, if you already applied v1,
just remove the empty line after <branch>:: and before +.

 Documentation/git-checkout.txt |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt
index 0b5485b..223ea9c 100644
--- a/Documentation/git-checkout.txt
+++ b/Documentation/git-checkout.txt
@@ -126,9 +126,13 @@ the conflicted merge in the specified paths.
 <new_branch>::
 	Name for the new branch.
 
+<tree-ish>::
+	Tree to checkout from (when paths are given). If not specified,
+	the index will be used.
+
 <branch>::
-	Branch to checkout; may be any object ID that resolves to a
-	commit.  Defaults to HEAD.
+	Branch to checkout (when no paths are given); may be any object
+	ID that resolves to a commit.  Defaults to HEAD.
 +
 When this parameter names a non-branch (but still a valid commit object),
 your HEAD becomes 'detached'.
-- 
1.6.2.2.449.g92961.dirty

```
