#!/bin/bash # # Script for hands-free use of 'git show-branch', with the option of specifying # unwanted refs by prefixing with ^ at the command line (syntax elsewhere # permitted). Refs to be ignored permanently can be added to $sed_script below # Main upstream branch upstream="${upstream:-origin/master}" # Refs pattern to always ignore sed_script=' /.stgit$/d ' # Process args for i; do case "$i" in ^*) # Remove all refs at the comand line prefixed with ^ sed_script="$sed_script;/$i/d" shift ;; esac done # Get short names of all head refs, sorted by committer date. Then filter # through sed refs="$(git for-each-ref --format='%(refname:short)' --sort='committerdate' refs/heads/\* | sed "$sed_script")" set -x git show-branch --sparse $upstream $refs $@ # vim: set tw=80: