]>
Tony Duckles's Git Repositories (git.nynim.org) - dotfiles.git/blob - bin/git-branch-dates
2 # Usage: git-branch-dates
3 # Show git branches by date - useful for showing active branches
5 # - http://www.commandlinefu.com/commands/view/2345/show-git-branches-by-date-useful-for-showing-active-branches
6 # - https://stackoverflow.com/a/30076212
8 format
='%(HEAD) %(color:green)%(refname:short)%(color:reset)|%(color:bold black)%(committerdate:relative)%(color:reset)'
9 if [[ "$1" = "-v" || "$1" = "-vv" ]]; then
11 format
="$format"'|%(color:yellow)%(objectname:short)%(color:reset) %(contents:subject)'
14 # For the `cut`-based line truncation handling below, since `cut` works based
15 # on chars/bytes and since the `git branch` will contain SGR escape sequences
16 # for coloring, predict how many "extra" bytes will be in each line due to the
17 # coloring in the `format` defined above.
22 --sort=-committerdate \
26 | cut
-c 1-$(expr $(tput cols) + $extra_color_len)