Last active
December 22, 2015 01:38
-
-
Save saneef/6397406 to your computer and use it in GitHub Desktop.
# Bash Profile * Display Current Git branch together with current full path on Bash prompt
* Autocomplete commands after ‘sudo’
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
## Git branch and current full path in prompt. | |
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' | |
} | |
# Use \W instead of \w to show only current directory | |
export PS1="\u@\h: \w\[\033[32m\]\$(parse_git_branch)\[\033[00m\] $ " | |
## Autocomplete after ‘sudo’ | |
if [ "$PS1" ]; then | |
complete -cf sudo | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment