]> Tony Duckles's Git Repositories (git.nynim.org) - dotfiles.git/blob - bin/git-branch-dates
.bash_profile: Register id_ed25519 SSH key with ssh-agent, if present
[dotfiles.git] / bin / git-branch-dates
1 #!/bin/bash
2 # Usage: git-branch-dates
3 # Show git branches by date - useful for showing active branches
4 # Inspired by:
5 # - http://www.commandlinefu.com/commands/view/2345/show-git-branches-by-date-useful-for-showing-active-branches
6 # - https://stackoverflow.com/a/30076212
7
8 format='%(HEAD) %(color:green)%(refname:short)%(color:reset)|%(color:bold black)%(committerdate:relative)%(color:reset)'
9 if [[ "$1" = "-v" || "$1" = "-vv" ]]; then
10 shift
11 format="$format"'|%(color:yellow)%(objectname:short)%(color:reset) %(contents:subject)'
12 fi
13 git branch \
14 --color=always \
15 --sort=-committerdate \
16 --format="$format" \
17 $* | column -ts'|'