Skip to content

Instantly share code, notes, and snippets.

@stim371
Created February 11, 2013 00:52
Show Gist options
  • Save stim371/4751756 to your computer and use it in GitHub Desktop.
Save stim371/4751756 to your computer and use it in GitHub Desktop.
Not sure if this works.
#!/bin/bash
git_prompt ()
{
if ! git rev-parse --git-dir > /dev/null 2>&1; then
return 0
fi
git_branch=$(git branch 2>/dev/null| sed -n '/^\*/s/^\* //p')
if git diff --quiet 2>/dev/null >&2; then
git_color="${c_git_clean}"
else
git_color=${c_git_dirty}
fi
echo " [$git_color$git_branch${c_reset}]"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment