Last active
August 21, 2018 20:13
-
-
Save amoodie/4001f7f3c0be8aeb29828ecd7d9b7cfa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# added by AM | |
# Show git branch name | |
# based largely on code from ankurk91: https://gist.github.com/ankurk91/2efe14650d54d7d09528cea3ed432f6d#file-bashrc-md | |
# and | |
# Dominik Schoeler: https://makandracards.com/makandra/1090-customize-your-bash-prompt | |
# | |
force_color_prompt=yes | |
color_prompt=yes | |
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' | |
} | |
if [ "$color_prompt" = yes ]; then | |
PS1='\[\e[01;30m\]\t ${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u \[\033[00m\]\[\033[01;34m\]\W:\[\033[01;31m\]$(parse_git_branch)\[\033[00m\]\$ ' | |
else | |
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\W$(parse_git_branch)\$ ' | |
fi | |
unset color_prompt force_color_prompt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yeah I like this. Definitely incorporating the git branch bit.