Last active
November 20, 2017 10:32
-
-
Save Vladnev/de19107569e39fdae898795db92acda4 to your computer and use it in GitHub Desktop.
Bash function for show git branches in subdirs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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