Skip to content

Instantly share code, notes, and snippets.

@mortymacs
Last active December 15, 2015 17:59
Show Gist options
  • Select an option

  • Save mortymacs/5300114 to your computer and use it in GitHub Desktop.

Select an option

Save mortymacs/5300114 to your computer and use it in GitHub Desktop.
Showing branch and commits number of current directory
function gb
{
if [ -d ".git" ]
then
cc=$(git log --pretty=oneline|wc -l)
gb=$(git branch | grep '*' | awk '{print $2}')
echo [$gb:$cc]
fi
}
## then add to your command line
#PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w[\t]$(gb) $ '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment