Skip to contentSkip to conversation

Add -v and --abbrev options to git-branch

PATCH In review Lars Hjemli 2 participants 3 messages Aug 11, 2016 Documentation

lore
Share & tools
lore
#1 lore raw
In reply to Lars Hjemli
Quoted 2 lines · Lars Hjemli

The new -v option makes git-branch show the abbreviated sha1 + subjectline for each branch.

Isn't what git-show-ref is about? Or git-for-each-ref?

Signature · 3 lines
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
#2 lore raw
Quoted 1 line · Jakub Narebski

Isn't what git-show-ref is about? Or git-for-each-ref?

Yes, there seem to be some overlap in functionality here :-)

The thing with git-branch is that it shows me which branch I'm currently on, someting neither git-show-ref nor git-for-each-ref does. And the "starred" branch, combined with hash and commit subject is very useful for me (It reminds me where I am, and where I have been, and what i did there....)

Finally, git-for-each-ref is more like plumbing, I wanted someting a little more userfriendly

#0 lore raw

PATCH 1/1 Add -v and --abbrev options to git-branch

The new -v option makes git-branch show the abbreviated sha1 + subjectline for each branch.

Additionally, minimum abbreviation length can be specified with --abbrev=<length>

---
 Documentation/git-branch.txt |    9 +++++++-
 builtin-branch.c             |   46 ++++++++++++++++++++++++++++++++++++-----
 2 files changed, 48 insertions(+), 7 deletions(-)
Documentation/git-branch.txt +8 -1
index 5376760..4f5b5d5 100644
@@ -8,7 +8,7 @@ git-branch - List, create, or delete bra
 SYNOPSIS
 --------
 [verse]
-'git-branch' [-r] [-a]
+'git-branch' [-r] [-a] [-v] [--abbrev=<length>]
 'git-branch' [-l] [-f] <branchname> [<start-point>]
 'git-branch' (-d | -D) <branchname>...
 
@@ -52,6 +52,13 @@ OPTIONS
 -a::
 	List both remote-tracking branches and local branches.
 
+-v::
+	Show sha1 and subject message for each head.
+
+--abbrev=<length>::
+	Alter minimum display length for sha1 in output listing,
+	default value is 7.
+
 <branchname>::
 	The name of the branch to create or delete.
 	The new branch name must pass all checks defined by
builtin-branch.c +40 -6

104 lines not on this page · raw message

Signature · 1 line
1.4.4