Skip to content

Instantly share code, notes, and snippets.

@CyberStrike
Created December 14, 2014 21:35
Show Gist options
  • Save CyberStrike/331ec0130eaf441d5c8d to your computer and use it in GitHub Desktop.
Save CyberStrike/331ec0130eaf441d5c8d to your computer and use it in GitHub Desktop.
My .bash_profile
# Source Git
source /c/'Program Files (x86)'/git/etc/git-completion.bash
source /c/'Program Files (x86)'/git/etc/git-prompt.sh
# Reset
Color_Off='\e[0m' # Text Reset
# Regular Colors
Black='\e[0;30m' # Black
Red='\e[0;31m' # Red
Green='\e[0;32m' # Green
Yellow='\e[0;33m' # Yellow
Blue='\e[0;34m' # Blue
Purple='\e[0;35m' # Purple
Cyan='\e[0;36m' # Cyan
White='\e[0;37m' # White
Symbol='§ '
function git_color {
trap 'exit' ERR
local git_status="$(git status 2> /dev/null)"
if [[ $git_status != "working directory clean" ]]; then
echo $Red
elif [[ $git_status == "Your branch is ahead of" ]]; then
echo $Yellow
elif [[ $git_status == "nothing to commit" ]]; then
echo $Green
else
echo $Color_Off
fi
}
# Set a default prompt of: user@host and current_directory
# export PS1="\[$Blue\]\u\[$White\]@\[$Green\]\h\[$White\]:\[$Purple\]\W\[$Yellow\][$Symbol][$White\] "
PROMPT_COMMAND='__git_ps1 "\[$Blue\]\u\[$Yellow\]@\[$Green\]\h\[$Yellow\]:\[$Purple\]\W\[$(git_color)\]" "\[$White\]\$Symbol"'
# Uncomment to use the terminal colours set in DIR_COLORS
# eval "$(dircolors -b /etc/DIR_COLORS)"
# Ignore case when auto-completing
set completion-ignore-case on
# Aliases
alias ..='cd ..'
alias ga='git add'
alias gc='git commit'
alias gco='git checkout'
alias gcm='git commit -am'
alias gst='git status'
alias gpr='git pull --rebase'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment