path: root/Documentation
diff options
authorDaniels Umanovskis <>2018-10-25 19:04:21 (GMT)
committerJunio C Hamano <>2018-10-26 01:35:00 (GMT)
commit0ecb1fc7269e15be890870937b8b639c987abd08 (patch)
treeedf506ae54602e0ee6aec9c10986fe928483b9bd /Documentation
parent5a0cc8aca797dbd7d2be3b67458ff880ed45cddf (diff)
branch: introduce --show-current display option
When called with --show-current, git branch will print the current branch name and terminate. Only the actual name gets printed, without refs/heads. In detached HEAD state, nothing is output. Intended both for scripting and interactive/informative use. Unlike git branch --list, no filtering is needed to just get the branch name. Signed-off-by: Daniels Umanovskis <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'Documentation')
1 files changed, 5 insertions, 1 deletions
diff --git a/Documentation/git-branch.txt b/Documentation/git-branch.txt
index bf5316f..0babb9b 100644
--- a/Documentation/git-branch.txt
+++ b/Documentation/git-branch.txt
@@ -9,7 +9,7 @@ SYNOPSIS
'git branch' [--color[=<when>] | --no-color] [-r | -a]
- [--list] [-v [--abbrev=<length> | --no-abbrev]]
+ [--list] [--show-current] [-v [--abbrev=<length> | --no-abbrev]]
[--column[=<options>] | --no-column] [--sort=<key>]
[(--merged | --no-merged) [<commit>]]
[--contains [<commit]] [--no-contains [<commit>]]
@@ -160,6 +160,10 @@ This option is only applicable in non-verbose mode.
branch --list 'maint-*'`, list only the branches that match
the pattern(s).
+ Print the name of the current branch. In detached HEAD state,
+ nothing is printed.