Last active
December 27, 2017 21:50
-
-
Save ctranstrum/c0a3792aa5a8917e07a2c846c5933df3 to your computer and use it in GitHub Desktop.
Bash git prompt
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
override_git_prompt_colors() { | |
GIT_PROMPT_THEME_NAME="Custom" | |
user=$(whoami | sed "s/\..*$//") | |
os="" | |
## These are the color definitions used by gitprompt.sh | |
GIT_PROMPT_PREFIX="" # start of the git info string | |
GIT_PROMPT_SUFFIX=" ═╕" # the end of the git info string | |
GIT_PROMPT_SEPARATOR=" " # separates each item | |
GIT_PROMPT_MASTER_BRANCH="${BoldRed}" # warning color if we are working in the master branch | |
GIT_PROMPT_BRANCH="${BoldCyan}" # the git branch that is active in the current directory | |
GIT_PROMPT_STAGED="${Green}●" # the number of staged files/directories | |
GIT_PROMPT_CONFLICTS="${Red}≠" # the number of files in conflict | |
GIT_PROMPT_CHANGED="${BoldYellow}±" # the number of changed files | |
GIT_PROMPT_UNTRACKED="${Cyan}…" # the number of untracked files/dirs | |
GIT_PROMPT_STASHED="${BoldBlue}⚑" # the number of stashed files/dir | |
GIT_PROMPT_CLEAN="${BoldGreen}√" # a colored flag indicating a "clean" repo | |
# GIT_PROMPT_REMOTE=" " # the remote branch name (if any) and the symbols for ahead and behind | |
## For the command indicator, the placeholder _LAST_COMMAND_STATE_ | |
## will be replaced with the exit code of the last command | |
GIT_PROMPT_COMMAND_OK="" # indicator if the last command returned with an exit code of 0 | |
GIT_PROMPT_COMMAND_FAIL="${Red}«_LAST_COMMAND_STATE_»" # indicator if the last command returned with an exit code of other than 0 | |
## _LAST_COMMAND_INDICATOR_ will be replaced by the appropriate GIT_PROMPT_COMMAND_OK OR GIT_PROMPT_COMMAND_FAIL | |
GIT_PROMPT_START_USER="╒═_LAST_COMMAND_INDICATOR_\[\e]0;$user \w\a\]" | |
GIT_PROMPT_END_USER="\n└> ${BoldWhite}$os $user${ResetColor} ${BoldBlue}\w${ResetColor}$ " | |
## Please do not add colors to these symbols | |
# GIT_PROMPT_SYMBOLS_AHEAD="↑·" # The symbol for "n versions ahead of origin" | |
# GIT_PROMPT_SYMBOLS_BEHIND="↓·" # The symbol for "n versions behind of origin" | |
# GIT_PROMPT_SYMBOLS_PREHASH=":" # Written before hash of commit, if no name could be found | |
# GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING="L" # This symbol is written after the branch, if the branch is not tracked | |
} | |
reload_git_prompt_colors "Custom" |
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_PROMPT_ONLY_IN_REPO=1 | |
GIT_PROMPT_THEME=Custom | |
GIT_PROMPT_THEME_FILE=~/.git-prompt-colors.sh | |
source ~/.bash_git_prompt/gitprompt.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment