Skip to content

Instantly share code, notes, and snippets.

@sunil-bagde
Last active April 2, 2024 13:18
Show Gist options
  • Save sunil-bagde/e590fb3755f8a5b14ed0e56966962ab7 to your computer and use it in GitHub Desktop.
Save sunil-bagde/e590fb3755f8a5b14ed0e56966962ab7 to your computer and use it in GitHub Desktop.
Git bash
colors.sh
# This is the custom theme template for gitprompt.sh
# These are the defaults from the "Default" theme
# You just need to override what you want to have changed
function prompt_callback {
gp_set_window_title ${PWD}
}
override_git_prompt_colors() {
GIT_PROMPT_THEME_NAME="Custom"
# Time12a="\$(date +%H:%M)"
PathShort="\W";
GIT_PROMPT_PREFIX="(" # start of the git info string
GIT_PROMPT_SUFFIX=")"
GIT_PROMPT_CHANGED="${Green}✚ " # the number of changed files
GIT_PROMPT_UNTRACKED="${Red} ✘"
GIT_PROMPT_START_USER="${Cyan}➜ ${Yellow}${PathShort}${ResetColor}"
#reload_git_prompt_colors "Custom"
GIT_PROMPT_END_USER="\n${White}$ ${ResetColor}"
GIT_PROMPT_BRANCH="${Magenta}"
## 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_BRANCH="${Magenta}" # the git branch that is active in the current directory
# GIT_PROMPT_MASTER_BRANCH="${GIT_PROMPT_BRANCH}" # used if the git branch that is active in the current directory is $GIT_PROMPT_MASTER_BRANCHES
# GIT_PROMPT_STAGED="${Red}●" # the number of staged files/directories
# GIT_PROMPT_CONFLICTS="${Red}✖ " # the number of files in conflict
# GIT_PROMPT_CHANGED="${Blue}✚ " # the number of changed files
# GIT_PROMPT_REMOTE=" " # the remote branch name (if any) and the symbols for ahead and behind
# 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
## For the command indicator, the placeholder _LAST_COMMAND_STATE_
## will be replaced with the exit code of the last command
## e.g.
## GIT_PROMPT_COMMAND_OK="${Green}✔-_LAST_COMMAND_STATE_ " # 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
# GIT_PROMPT_COMMAND_OK="${Green}✔" # 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
## template for displaying the current virtual environment
## use the placeholder _VIRTUALENV_ will be replaced with
## the name of the current virtual environment (currently CONDA and VIRTUAL_ENV)
# GIT_PROMPT_VIRTUALENV="(${Blue}_VIRTUALENV_${ResetColor}) "
# template for displaying the current remote tracking branch
# use the placeholder _UPSTREAM_ will be replaced with
# the name of the current remote tracking branch
# GIT_PROMPT_UPSTREAM=" {${Blue}_UPSTREAM_${ResetColor}}"
## _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_ ${Yellow}${PathShort}${ResetColor}"
# GIT_PROMPT_START_ROOT="_LAST_COMMAND_INDICATOR_ ${GIT_PROMPT_START_USER}"
# GIT_PROMPT_END_USER=" \n${White}${Time12a}${ResetColor} $ "
# GIT_PROMPT_END_ROOT=" \n${White}${Time12a}${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
# branch name(s) that will use $GIT_PROMPT_MASTER_BRANCH color
# To specify multiple branches, use
# shopt -s extglob
# GIT_PROMPT_MASTER_BRANCHES='@(master|production)'
# GIT_PROMPT_MASTER_BRANCHES="master"
}
reload_git_prompt_colors "Custom"
C:\Program Files\Git\etc\profile.d\git-prompt.sh
GIT bash origin
PS1='\[\033]0;${PWD//[^[:ascii:]]/?}\007\]'
PS1="$PS1" # new line
PS1="$PS1"'\[\033[36m\]' # change to green
PS1="$PS1"'➜ ' # ➜
PS1="$PS1"'\[\033[0m\]' # change color
MSYS2_PS1="$PS1" # for detection by MSYS2 SDKs bash.basrc
if test -z "$WINELOADERNOEXEC"
then
GIT_EXEC_PATH="$(git --exec-path 2>/dev/null)"
COMPLETION_PATH="${GIT_EXEC_PATH%/libexec/git-core}"
COMPLETION_PATH="${COMPLETION_PATH%/lib/git-core}"
COMPLETION_PATH="$COMPLETION_PATH/share/git/completion"
if test -f "$COMPLETION_PATH/git-prompt.sh"
then
. "$COMPLETION_PATH/git-completion.bash"
. "$COMPLETION_PATH/git-prompt.sh"
PS1="$PS1"'\[\033[36m\]' # change color to cyan
PS1="$PS1"'`__git_ps1`' # bash function
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment