Last active
December 12, 2018 10:24
-
-
Save mfts/0b3092738bc6a6b745a6 to your computer and use it in GitHub Desktop.
Terminal prompt to show "user@computer:working_directory (git_branch) $ "
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
# Copy the functions below to your ~/.bash_profile | |
git-dirty() { | |
[[ $(git status 2>/dev/null | tail -n1) != "nothing to commit, working tree clean" ]] && echo "*" | |
} | |
parse_git_branch() { | |
git branch 2> /dev/null | sed -e "/^[^*]/d" -e "s/* \(.*\)/ (\1$(git-dirty))/" | |
} | |
export PS1="\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[0;34m\$(parse_git_branch)\[\033[00m\] $ " |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment