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

[PATCH 1/2] docs: clarify git-branch --list behavior

From
Jeff King <peff@peff.net>
Date
Jan 31, 2013, 06:45 UTC
Message-ID
<20130131064545.GA25315@sigill.intra.peff.net>
In-Reply-To
<20130131064357.GA24660@sigill.intra.peff.net>

It was not clear from the "description" section of git-branch(1) that using a <pattern> meant that you _had_ to use the --list option. Let's clarify that, and while we're at it, reword some clunky and ambiguous sentences.

Signed-off-by: Jeff King <peff@peff.net>
---
 Documentation/git-branch.txt | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/Documentation/git-branch.txt b/Documentation/git-branch.txt
index 45a225e..01aa87f 100644
--- a/Documentation/git-branch.txt
+++ b/Documentation/git-branch.txt
@@ -22,13 +22,15 @@ DESCRIPTION
 DESCRIPTION
 -----------
 
-With no arguments, existing branches are listed and the current branch will
-be highlighted with an asterisk.  Option `-r` causes the remote-tracking
-branches to be listed, and option `-a` shows both. This list mode is also
-activated by the `--list` option (see below).
-<pattern> restricts the output to matching branches, the pattern is a shell
-wildcard (i.e., matched using fnmatch(3)).
-Multiple patterns may be given; if any of them matches, the branch is shown.
+If `--list` is given, or if there are no non-option arguments, existing
+branches are listed; the current branch will be highlighted with an
+asterisk.  Option `-r` causes the remote-tracking branches to be listed,
+and option `-a` shows both local and remote branches. If a `<pattern>`
+is given, it is used as a shell wildcard to restrict the output to
+matching branches. If multiple patterns are given, a branch is shown if
+any it is matched by any of the patterns.  Note that when providing a
+`<pattern>`, you must use `--list`; otherwise the command is interpreted
+as branch creation.
 
 With `--contains`, shows only the branches that contain the named commit
 (in other words, the branches whose tip commits are descendants of the
-- 
1.8.1.2.5.g1cb3f73
Previous: Jeff KingNext: Eric Sunshine
Message 3 of 11 in “[BUG] `git branch --contains ID name` creates branch "name"”
  1. Peter WuJan 30, 2013
  2. 0/2 improve "git branch --contains=<commit> <pattern>"Jeff King, Jan 31, 2013
  3. 1/2 docs: clarify git-branch --list behaviorJeff King, Jan 31, 2013
  4. Eric SunshineFeb 1, 2013
  5. Junio C HamanoFeb 1, 2013
  6. Jeff KingFeb 1, 2013
  7. Junio C HamanoFeb 1, 2013
  8. 2/2 branch: let branch filters imply --listJeff King, Jan 31, 2013
  9. Peter WuJan 31, 2013
  10. Junio C HamanoJan 31, 2013
  11. Junio C HamanoJan 31, 2013

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.