Skip to content

Instantly share code, notes, and snippets.

@pdkovacs
Last active February 3, 2019 14:46
Show Gist options
  • Save pdkovacs/1c84b14ada5ea81613d446f8daf634d1 to your computer and use it in GitHub Desktop.
Save pdkovacs/1c84b14ada5ea81613d446f8daf634d1 to your computer and use it in GitHub Desktop.
git-branch-prompt
git_branch_ps() {
git_branch=$(git branch 2>/dev/null | grep "^*" | colrm 1 2)
if [ -n "$git_branch" ];
then
echo " ($git_branch)"
fi
}
export PS1='\u@\w$(git_branch_ps) $ '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment