# short aliases. alias gps="git push" alias gpsf="git push --force" alias gpl="git pull" alias gl="git log" alias gs="git status" alias gst="git stash" alias gd="git diff" alias gc="git commit -m" alias gch="git checkout" alias gchb="git checkout -b" alias gb="git branch --all" alias gbd="git branch -D" alias gf="git fetch --all -v -p" alias gt="git tag" alias gi="git ls-files -ci --exclude-standard -z | xargs -0 git rm --cached" alias gpc="git diff >" alias gp="git apply" # alias to preview diff while adding. adds current dir by default. # usage: ga [FILES] ga() { local target=${@} if [[ "${target}" = "" ]]; then target="." fi git diff ${target} git add ${target} } # rebase by X commits or from root. when COUNT is 0 - rebase from root. default is 2. # usage: gr [COMMIT COUNT] gr() { local base="${1}" # rebase last 2 commits by default. if [[ "${base}" = "" ]]; then base="2" fi # if 0, rebase from root. else from specified base. if [[ "${base}" = "0" ]]; then git rebase -i --root else git rebase -i HEAD~${base} fi } # specify git user as Dmitry Voronin with provided email. # usage: gu [EMAIL] gu() { local name="Dmitry Voronin" local email="${1}" if [[ "${name}" = "" || "${email}" = "" ]]; then echo "usage: gu [EMAIL]" return 1 fi git config user.name "${name}" git config user.email "${email}" } # autocomplete. _completion_loader git __git_complete gps _git_push __git_complete gpsf _git_push __git_complete gpl _git_pull __git_complete gl _git_log __git_complete gs _git_status __git_complete gst _git_stash __git_complete gd _git_diff __git_complete gc _git_commit __git_complete gch _git_checkout __git_complete gchb _git_checkout __git_complete gb _git_branch __git_complete gbd _git_branch __git_complete gf _git_fetch __git_complete gt _git_tag __git_complete gp _git_apply __git_complete ga _git_add _gu() { _autocomplete_first account@voronind.com dd.voronin@fsight.ru } complete -F _gu gu