Last active
October 23, 2017 00:14
-
-
Save ys-qb/54cf7464d8712fd99f74669ac7188bbb to your computer and use it in GitHub Desktop.
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
if [ -f ~/.bash-git-prompt/gitprompt.sh ]; then | |
GIT_PROMPT_ONLY_IN_REPO=1 | |
GIT_PROMPT_THEME=Custom # use custom theme specified in file GIT_PROMPT_THEME_FILE (default ~/.git-prompt-colors.sh) | |
source ~/.bash-git-prompt/gitprompt.sh | |
fi |
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
# This is an alternative approach. Single line minimalist in git repo. | |
override_git_prompt_colors() { | |
#GIT_PROMPT_THEME_NAME="Single_line_Minimalist" | |
GIT_PROMPT_THEME_NAME="Custom" | |
function prompt_callback { | |
local PS1="$(gp_truncate_pwd)" | |
gp_set_window_title "$PS1" | |
} | |
Time12a="\$(date +%H:%M:%S)" | |
#HostAndUser="\u@\h" | |
HostAndUser="\h" | |
PathShort="\w"; | |
GIT_PROMPT_PREFIX="[" | |
GIT_PROMPT_SUFFIX="]" | |
GIT_PROMPT_SEPARATOR=" " | |
GIT_PROMPT_STAGED="${Blue}✚${ResetColor}" | |
GIT_PROMPT_CONFLICTS="${Red}✖${ResetColor}" | |
GIT_PROMPT_CHANGED="${Red}❗${ResetColor}" | |
GIT_PROMPT_UNTRACKED="${Cyan}…${ResetColor}" | |
GIT_PROMPT_STASHED="${BoldBlue}⚑${ResetColor}" | |
#GIT_PROMPT_CLEAN="${BoldGreen}✔${ResetColor}" | |
GIT_PROMPT_CLEAN="" | |
#GIT_PROMPT_COMMAND_OK="${Green}✔" | |
GIT_PROMPT_COMMAND_OK="" | |
GIT_PROMPT_COMMAND_FAIL="${Red}✘" | |
GIT_PROMPT_START_USER="_LAST_COMMAND_INDICATOR_${Red}${HostAndUser}${ResetColor} ${Cyan}${PathShort}${ResetColor}" | |
GIT_PROMPT_END_USER="${ResetColor} " | |
GIT_PROMPT_END_ROOT="${BoldRed} # " | |
} | |
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
[alias] | |
co = checkout | |
ci = commit | |
cia = commit --amend | |
st = status | |
br = branch | |
sdiff = diff --staged | |
hdiff = diff HEAD | |
go = "!f() { git checkout -b \"$1\" 2> /dev/null || git checkout \"$1\"; }; f" | |
p2g = "!f() { git diff HEAD --no-prefix | gist -p -f patch_`date +%Y%m%d`.patch; }; f" | |
g2p = "!f() { gist -p -r \"$1\" 2> /dev/null | patch -p0 ; }; f" | |
rh = reset --hard HEAD #rest hard | |
rhc = "!f() { git reset --hard HEAD && git clean -fd; }; f" | |
hist = log --pretty=format:\"%h %ad | %s%d [%an]\" --graph --date=short | |
type = cat-file -t | |
dump = cat-file -p |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment