Skip to content

Instantly share code, notes, and snippets.

@bodiam
Created August 29, 2013 11:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bodiam/6376782 to your computer and use it in GitHub Desktop.
Save bodiam/6376782 to your computer and use it in GitHub Desktop.
Bash script to show the name of branch per module.
#!/bin/bash
txt_green=$(tput setaf 2)
txt_purple=$(tput setaf 5)
txt_reset=$(tput sgr0)
for i in */
do
cd $i
git_branch=`git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1'/`
printf "%-40s %s\n" "$i" "[${txt_green}$git_branch${txt_reset}]"
cd ..
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment