Last active
December 18, 2015 20:29
-
-
Save dsamardzija/5840456 to your computer and use it in GitHub Desktop.
Shell prompt with git branch and dirty state
This file contains hidden or 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
source ~/.git-completion.sh | |
COLOR_1="\[\e[0;32m\]" # green | |
COLOR_2="\[\e[1;34m\]" # blue | |
COLOR_3="\[\e[1;37m\]" # white | |
USER_AT_HOST="\u@\h" | |
TIME_WITH_BRACKETS="[\t]" | |
SPACE=" " | |
DIR="\w" | |
DIR_BASENAME="\W" | |
PROMPT="$" | |
GIT_PROMPT='$(__git_ps1 "[%s]")' | |
PS1=${COLOR_1}${TIME_WITH_BRACKETS}${SPACE}${USER_AT_HOST}${SPACE}${COLOR_3}${DIR_BASENAME}${SPACE}${GIT_PROMPT}${SPACE}${COLOR_1}${PROMPT}${SPACE}${COLOR_3} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
looks something like this:
[02:32:55] dejan@magnus-01 cool_project [develop *] $
just add gist to your .bash_profile or .bashrc and copy .git-completion.sh file to appropriate location
you can find it at:
https://github.com/git/git/blob/master/contrib/completion/git-completion.bash