Skip to content

Instantly share code, notes, and snippets.

@Vladnev
Last active November 20, 2017 10:32
Show Gist options
  • Save Vladnev/de19107569e39fdae898795db92acda4 to your computer and use it in GitHub Desktop.
Save Vladnev/de19107569e39fdae898795db92acda4 to your computer and use it in GitHub Desktop.
Bash function for show git branches in subdirs
function show_branches()
{
for sub in *; do
[[ -d "${sub}/.git" ]] || continue
local BRANCH="$(cd "$sub"; git for-each-ref refs/heads/$(git branch 2>/dev/null|sed -n '/^\*/s/^\* //p') --format='%(authordate:short)%09(%(committerdate:relative))%09[%1B[0;33m%(refname:short)%1B[m]')"
echo "$sub $BRANCH"
done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment