brew install git bash-completion
Basic config:
git config --global user.name "Your Name"
git config --global user.email "[email protected]"
git config --global alias.co checkout
git config --global apply.whitespace nowarn
Create an SSH key
ssh-keygen
Hit return a couple of times -- leave password blank if you want.
Copy your ssh key into memory:
cat ~/.ssh/id_rsa.pub | pbcopy
Paste that code into your settings page on your repository host(s).
Paste the following into your ~/.gitconfig
file:
[color]
branch = auto
diff = auto
status = auto
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow bold
frag = magenta bold
old = red bold
new = green bold
[color "status"]
added = yellow
changed = green
untracked = cyan
alias g="git"
alias ga="git add"
alias gc="git checkout"
alias gcm="git commit -m"
alias gm="git merge"
alias gp="git pull"
alias gll="git ll"
alias gl="git log"
alias gs="git status"
# bash history
shopt -s histappend
export HISTCONTROL=ignoredups:erasedups
HISTFILESIZE=100000
HISTSIZE=10000
PROMPT_COMMAND=$PROMPT_COMMAND'history -a; '
# virtualenvwrapper
source /usr/local/bin/virtualenvwrapper.sh
CYAN=$(tput setaf 6)
NORMAL=$(tput sgr0)
function __venv_prefix {
if test "$VIRTUAL_ENV" ; then
printf "(${CYAN}`basename \"$VIRTUAL_ENV\"`${NORMAL}) "
fi
}
PROMPT_COMMAND=$PROMPT_COMMAND'__venv_prefix; '
# git bash completion
[ -f /usr/local/etc/bash_completion ] && source /usr/local/etc/bash_completion
GIT_PS1_SHOWDIRTYSTATE=true
GIT_PS1_SHOWCOLORHINTS=true
PROMPT_COMMAND=$PROMPT_COMMAND'__git_ps1 "\w" ":\$ "; '
__git_complete g __git_main
__git_complete gc _git_checkout
__git_complete gm __git_merge
__git_complete gp _git_pull
Add syntax on
to ~/.vimrc
If you want to have a different email address for a particular project (a personal project on your work computer, perhaps?), just run this command inside that project's folder:
git config user.email "[email protected]"
It's the same command as before, this time just omitting the --global
.