-
-
Notifications
You must be signed in to change notification settings - Fork 14
/
git-bvv
executable file
·27 lines (23 loc) · 949 Bytes
/
git-bvv
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/bash
# Custom Git command: git bvv
#
# An enhanced version of the 'git branch -vv' command.
#
# This version will list branches sorted from most to least recent (by last
# commit date) whilst also displaying more details per each branch (last commit
# date and author).
#
# Note, Git 2.19 (or later) is required.
_widest_branch_name=$(git branch --format='%(refname:short)' "$@" | awk '{ print length() }' | sort -r -n | head -1)
_width=$(($_widest_branch_name + 3))
_fmt="%(HEAD) \
%(align:$_width)%(color:green)%(refname:short)%(end) \
%(color:yellow)%(objectname:short)\
%(if)%(upstream)%(then) %(color:red)(%(upstream:short)%(color:reset)\
%(if)%(upstream:track)%(then): %(upstream:track,nobracket)\
%(end)%(color:red))\
%(end)\
%(color:reset) - \
%(color:green bold)(%(committerdate:relative)) \
%(color:reset)%(contents:subject) %(color:blue){%(authorname)}%(color:reset)"
git branch -vv --sort=-committerdate --format="$_fmt" "$@"