Skip to content

Instantly share code, notes, and snippets.

@mauro-oto
Created November 21, 2014 19:18
Show Gist options
  • Save mauro-oto/91a4bba7b39aead022e0 to your computer and use it in GitHub Desktop.
Save mauro-oto/91a4bba7b39aead022e0 to your computer and use it in GitHub Desktop.
Show git stash count when opening a new terminal window
Add this to your .zshrc or .bashrc for a quick reminder of saved stashes:
git_stashes_count () {
st_num=$(/usr/bin/git stash list 2> /dev/null | wc -l | tr -d ' ')
if [[ $st_num != "0" ]]; then
echo "$fg[red]$st_num$reset_color"
else {
echo "0"
}
fi
}
echo "You have $(git_stashes_count) stashes saved"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment