Skip to contentSkip to conversation

branch doc: Change `git branch <pattern>` to use `<branchname>`

PATCH In review Ævar Arnfjörð Bjarmason 4 participants 10 messages Mar 23, 2017 – Mar 24, 2017 Documentation

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 branch doc: Change `git branch <pattern>` to use `<branchname>`

Change an example for git branch <pattern> to say git branch <branchname> to be consistent with the synopsis. This changes documentation added in d8d33736b5 ("branch: allow pattern arguments", 2011-08-28).

---
 Documentation/git-branch.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/git-branch.txt +1 -1
index 092f1bcf9f..e65e5c0dee 100644
@@ -142,7 +142,7 @@ This option is only applicable in non-verbose mode.
 	List both remote-tracking branches and local branches.
 
 --list::
-	Activate the list mode. `git branch <pattern>` would try to create a branch,
+	Activate the list mode. `git branch <branchname>` would try to create a branch,
 	use `git branch --list <pattern>` to list matching branches.
 
 -v::
Signature · 1 line
2.11.0
#1 lore raw
Quoted 15 lines · Ævar Arnfjörð Bjarmason

Change an example for git branch <pattern> to say git branch <branchname> to be consistent with the synopsis. This changes documentation added in d8d33736b5 ("branch: allow pattern arguments", 2011-08-28).

---
 Documentation/git-branch.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/git-branch.txt +0 -0
index 092f1bcf9f..e65e5c0dee 100644

Documentation/git-branch.txt This option is only applicable in non-verbose mode. · line 146

Quoted 6 lines
Documentation/git-branch.txt +1 -1
@@ -142,7 +142,7 @@ This option is only applicable in non-verbose mode.
 	List both remote-tracking branches and local branches.
 
 --list::
-	Activate the list mode. `git branch <pattern>` would try to create a branch,
+	Activate the list mode. `git branch <branchname>` would try to create a branch,
 	use `git branch --list <pattern>` to list matching branches.

This makes the description more correct.

I am not sure if it makes that much sense to have that sentence here in the first place (after all, it is describing a behaviour of a mode that is *not* the list mode), but I guess that it may be a common mistake to forget to specify "-l" while asking for branches that match the pattern? If we were writing this today from scratch, I would perhaps write something entirely different, e.g.

--list::
List branches. With optional <pattern>... at the end of the command line, list only the branches that match any of the given patterns. Do not forget '-l' and say "git branch <pattern>", as it will instead try to create a new branch whose name is <pattern>, which is a common mistake.

though.

Thanks.

#2 lore raw
Quoted 33 lines · Junio C Hamano
Quoted 15 lines · Ævar Arnfjörð Bjarmason

Change an example for git branch <pattern> to say git branch <branchname> to be consistent with the synopsis. This changes documentation added in d8d33736b5 ("branch: allow pattern arguments", 2011-08-28).

---
 Documentation/git-branch.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/git-branch.txt +0 -0
index 092f1bcf9f..e65e5c0dee 100644

Documentation/git-branch.txt This option is only applicable in non-verbose mode. · line 146

Quoted 6 lines
Documentation/git-branch.txt +1 -1
@@ -142,7 +142,7 @@ This option is only applicable in non-verbose mode.
 	List both remote-tracking branches and local branches.
 
 --list::
-	Activate the list mode. `git branch <pattern>` would try to create a branch,
+	Activate the list mode. `git branch <branchname>` would try to create a branch,
 	use `git branch --list <pattern>` to list matching branches.

This makes the description more correct.

I am not sure if it makes that much sense to have that sentence here in the first place (after all, it is describing a behaviour of a mode that is *not* the list mode), but I guess that it may be a common mistake to forget to specify "-l" while asking for branches that match the pattern? If we were writing this today from scratch, I would perhaps write something entirely different, e.g.

Quoted 7 lines

--list::
List branches. With optional <pattern>... at the end of the command line, list only the branches that match any of the given patterns. Do not forget '-l' and say "git branch <pattern>", as it will instead try to create a new branch whose name is <pattern>, which is a common mistake.

Hmm, but with git-branch -l means --create-reflog not --list.

I have make the mistake of using -l rather than --list several times ... :D

ATB,
Ramsay Jones

#3 lore raw
Quoted 15 lines · Ramsay Jones
Quoted 7 lines

I am not sure if it makes that much sense to have that sentence here in the first place (after all, it is describing a behaviour of a mode that is *not* the list mode), but I guess that it may be a common mistake to forget to specify "-l" while asking for branches that match the pattern? If we were writing this today from scratch, I would perhaps write something entirely different, e.g.

Quoted 7 lines

--list::
List branches. With optional <pattern>... at the end of the command line, list only the branches that match any of the given patterns. Do not forget '-l' and say "git branch <pattern>", as it will instead try to create a new branch whose name is <pattern>, which is a common mistake.

Quoted 4 lines

Hmm, but with git-branch -l means --create-reflog not --list.

I have make the mistake of using -l rather than --list several times ... :D

That too. With "Do not forget '--list'..." and it will make it correct again ;-).

#4 lore raw
In reply to Junio C Hamano
Quoted 26 lines · Junio C Hamano
Quoted 15 lines · Ævar Arnfjörð Bjarmason

Change an example for git branch <pattern> to say git branch <branchname> to be consistent with the synopsis. This changes documentation added in d8d33736b5 ("branch: allow pattern arguments", 2011-08-28).

---
 Documentation/git-branch.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/git-branch.txt +0 -0
index 092f1bcf9f..e65e5c0dee 100644

Documentation/git-branch.txt This option is only applicable in non-verbose mode. · line 146

Quoted 6 lines
Documentation/git-branch.txt +1 -1
@@ -142,7 +142,7 @@ This option is only applicable in non-verbose mode.
      List both remote-tracking branches and local branches.
 
 --list::
-     Activate the list mode. `git branch <pattern>` would try to create a branch,
+     Activate the list mode. `git branch <branchname>` would try to create a branch,
      use `git branch --list <pattern>` to list matching branches.

This makes the description more correct.

Quoted 6 lines

I am not sure if it makes that much sense to have that sentence here in the first place (after all, it is describing a behaviour of a mode that is *not* the list mode), but I guess that it may be a common mistake to forget to specify "-l" while asking for branches that match the pattern? If we were writing this today from scratch, I would perhaps write something entirely different, e.g.

I'm just doing s/pattern/branchname/ on the existing documentation. If you'd like to entirely reword this to make that unnecessary that sounds good, but makes sense that you then submit that patch & just drop this one, rather than me copy/pasting your proposal, sending that as my own patch etc...

Quoted 7 lines

--list::
List branches. With optional <pattern>... at the end of the command line, list only the branches that match any of the given patterns. Do not forget '-l' and say "git branch <pattern>", as it will instead try to create a new branch whose name is <pattern>, which is a common mistake.

I like the old one better. It has 3 actual command examples you can readily see. This turns that into more prose that requires the reader to mentally parse most of it and mentally insert the mentioned command line switches into the equivalent of those 3 examples we just provided before.

Quoted 3 lines

though.

Thanks.

#5 lore raw
Quoted 14 lines · Ævar Arnfjörð Bjarmason
Quoted 5 lines

Documentation/git-branch.txt This option is only applicable in non-verbose mode. · line 146

Quoted 4 lines

--list::

Documentation/git-branch.txt +1 -1
-     Activate the list mode. `git branch <pattern>` would try to create a branch,
+     Activate the list mode. `git branch <branchname>` would try to create a branch,
      use `git branch --list <pattern>` to list matching branches.
Quoted 8 lines

This makes the description more correct.

I am not sure if it makes that much sense to have that sentence here in the first place (after all, it is describing a behaviour of a mode that is *not* the list mode), but I guess that it may be a common mistake to forget to specify "-l" while asking for branches that match the pattern? If we were writing this today from scratch, I would perhaps write something entirely different, e.g.

Quoted 5 lines

I'm just doing s/pattern/branchname/ on the existing documentation. If you'd like to entirely reword this to make that unnecessary that sounds good, but makes sense that you then submit that patch & just drop this one, rather than me copy/pasting your proposal, sending that as my own patch etc...

That is sensible. I've already queued yours as-is a few hours ago, and the remainder of this message is in preparation for a follow-up patch that is a separate topic.

Quoted 10 lines
Quoted 7 lines

--list::
List branches. With optional <pattern>... at the end of the command line, list only the branches that match any of the given patterns. Do not forget '-l' and say "git branch <pattern>", as it will instead try to create a new branch whose name is <pattern>, which is a common mistake.

I like the old one better. It has 3 actual command examples you can readily see.

Having the _wrong_ example git branch <branchname> that is readily available for cutting and pasting is the worst of the three reasons why I think the current text is bad (the other two being "it does not even help in explaining the --list option" and "The argument to the other mode is not <pattern> but is <branchname>").

I can go without "Do not forget ..." and everything that follows, though, and if we are going to do so, then

	--list::
		List branches.  With optional <pattern>...,
		e.g. `git branch --list 'maint-*`, list only the
		branches that match the pattern(s).

would be fine. I am not opposed to having an visually distinctive example--I just do not want to have one that is wrong without clearly marking it as such.

#6 lore raw
Quoted 11 lines · Junio C Hamano

I can go without "Do not forget ..." and everything that follows, though, and if we are going to do so, then

	--list::
		List branches.  With optional <pattern>...,
		e.g. `git branch --list 'maint-*`, list only the
		branches that match the pattern(s).

would be fine. I am not opposed to having an visually distinctive example--I just do not want to have one that is wrong without clearly marking it as such.

I like this one. I haven't witnessed "git branch maint-*" being a common mistake.

For comparison, "git branch -l maint-*" does seem to be a common mistake. It's a shame that the short-and-sweet "-l" was taken for that purpose. Perhaps it's worth calling that out here?

--list::
--list <pattern>::
List branches. If <pattern> is specified (e.g., "git branch --list 'maint-*'), list only the branches that match the pattern.
+
This should not be confused with git branch -l <branchname>, which creates a branch named <branchname> with a reflog. See --create-reflog above for details.

Thanks,
Jonathan

#7 lore raw

PATCH 1/1 branch doc: update description for `--list`

The paragraph begins with a sample command line git branch <name> that has nothing to do with the option being described. Remove it, but use the space to instead show that multiple patterns can be given.

Also mention the unfortunate -l that can be easily confused with it.

---
 Documentation/git-branch.txt | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
Documentation/git-branch.txt +7 -2
index 6a17ca591a..514b0d0b91 100644
@@ -142,8 +142,13 @@ This option is only applicable in non-verbose mode.
 	List both remote-tracking branches and local branches.
 
 --list::
-	Activate the list mode. `git branch <branchname>` would try to create a branch,
-	use `git branch --list <pattern>` to list matching branches.
+	List branches.  With optional `<pattern>...`, e.g. `git
+	branch --list 'maint-*'`, list only the branches that match
+	the pattern(s).
++
+This should not be confused with `git branch -l <branchname>`,
+which creates a branch named `<branchname>` with a reflog.
+See `--create-reflog` above for details.
 
 -v::
 -vv::
Signature · 1 line
2.12.1-432-gf364f02724
#9 lore raw

Re: [PATCH] branch doc: update description for `--list`

In reply to Junio C Hamano
Quoted 21 lines · Junio C Hamano

The paragraph begins with a sample command line git branch <name> that has nothing to do with the option being described. Remove it, but use the space to instead show that multiple patterns can be given.

Also mention the unfortunate -l that can be easily confused with it.

---
 Documentation/git-branch.txt | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
Documentation/git-branch.txt +0 -0
index 6a17ca591a..514b0d0b91 100644
@@ -142,8 +142,13 @@ This option is only applicable in non-verbose mode.
        List both remote-tracking branches and local branches.
 

Documentation/git-branch.txt This option is only applicable in non-verbose mode. · line 151

Quoted 10 lines
Documentation/git-branch.txt +7 -2
 --list::
-       Activate the list mode. `git branch <branchname>` would try to create a branch,
-       use `git branch --list <pattern>` to list matching branches.
+       List branches.  With optional `<pattern>...`, e.g. `git
+       branch --list 'maint-*'`, list only the branches that match
+       the pattern(s).
++
+This should not be confused with `git branch -l <branchname>`,
+which creates a branch named `<branchname>` with a reflog.
+See `--create-reflog` above for details.

Looks good to me.

Quoted 5 lines
Documentation/git-branch.txt +0 -1
 -v::
 -vv::
--

2.12.1-432-gf364f02724