Skip to content

Instantly share code, notes, and snippets.

@muayyad-alsadi
Created November 14, 2018 13:55
Show Gist options
  • Save muayyad-alsadi/c7b8713d7dc2394e3edc591c6ff0bdac to your computer and use it in GitHub Desktop.
Save muayyad-alsadi/c7b8713d7dc2394e3edc591c6ff0bdac to your computer and use it in GitHub Desktop.
add git branch to bash prompt
# add the below to your ~/.bash_profile
parse_git_branch() {
[ -d .git ] && {
echo -n '@'
git rev-parse --abbrev-ref HEAD
}
}
export PS1='[\u@\h \W$(parse_git_branch)]\$ '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment