31 lines
806 B
Bash
31 lines
806 B
Bash
# get the name of the branch we are on
|
|
function git_prompt_info() {
|
|
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
|
|
echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX"
|
|
}
|
|
|
|
function parse_git_dirty () {
|
|
if [[ -n $(git status -s 2> /dev/null) ]]; then
|
|
echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
|
|
else
|
|
echo "$ZSH_THEME_GIT_PROMPT_CLEAN"
|
|
fi
|
|
}
|
|
|
|
# Aliases
|
|
alias g='git'
|
|
alias ga='git add .'
|
|
alias gst='git status'
|
|
alias gl='git pull'
|
|
alias gup='git fetch && git rebase'
|
|
alias gp='git push'
|
|
alias gd='git diff -w "$@" | vim'
|
|
alias gc='git commit -v'
|
|
alias gca='git commit -v -a'
|
|
alias gco='git checkout'
|
|
alias gb='git branch'
|
|
alias gba='git branch -a'
|
|
alias gcount='git shortlog -sn'
|
|
alias gcp='git cherry-pick'
|
|
alias glg='git log --stat --max-count=5'
|