# Aliases alias gst='git status' compdef _git gst=git-status alias gdf='git diff HEAD' compdef _git gd=git-diff alias gdc='git diff --cached' compdef _git gdc=git-diff alias gl='git pull' compdef _git gl=git-pull alias gca='git commit -v -a' compdef _git gc=git-commit alias gci='git commit -m' compdef _git gcmsg=git-commit alias gco='git checkout' compdef _git gco=git-checkout alias gb='git branch' compdef _git gb=git-branch alias gba='git branch -a' compdef _git gba=git-branch alias gcount='git shortlog -sn' compdef gcount=git alias glo='git log --oneline' compdef _git glo=git-log alias st='git status -s' compdef _git st=git-status alias grh='git reset HEAD' # # Will return the current branch name # Usage example: git pull origin $(current_branch) # function current_branch() { ref=$(git symbolic-ref HEAD 2> /dev/null) || \ ref=$(git rev-parse --short HEAD 2> /dev/null) || return echo ${ref#refs/heads/} } function current_repository() { ref=$(git symbolic-ref HEAD 2> /dev/null) || \ ref=$(git rev-parse --short HEAD 2> /dev/null) || return echo $(git remote -v | cut -d':' -f 2) } # these aliases take advantage of the previous function alias ggpnp='git pull origin $(current_branch) && git push origin $(current_branch)' compdef ggpnp=git # Pretty log messages function _git_log_prettily(){ if ! [ -z $1 ]; then git log --pretty=$1 fi } alias glp="_git_log_prettily" compdef _git glp=git-log