Reorganized Git aliases.

This commit is contained in:
Sorin Ionescu 2012-01-20 22:32:17 -05:00
parent 3bc0c9f422
commit e7c72ac02a

View file

@ -2,53 +2,7 @@
alias g='git' alias g='git'
compdef g=git compdef g=git
# Working Copy (w) # Branch (b)
alias gws='git status --short'
compdef _git gws=git-status
alias gwS='git status'
compdef _git gwS=git-status
alias gwd='git diff --no-ext-diff'
compdef _git gwd=git-diff
function gwD() { git diff --no-ext-diff --ignore-all-space "$@" | view - }
compdef _git gwD=git-diff
alias gwr='git reset --soft'
compdef _git gwr=git-reset
alias gwR='git reset --hard'
compdef _git gwR=git-reset
alias gwc='git clean -n'
compdef _git gwc=git-clean
alias gwC='git clean -f'
compdef _git gwC=git-clean
alias gwx='git rm -r'
compdef _git gwx=git-rm
alias gwX='git rm -rf'
compdef _git gwX=git-rm
alias gwg='git grep'
compdef _git gwg=git-grep
# Index
alias gia='git add'
compdef _git gia=git-add
alias giA='git add --patch'
compdef _git giA=git-add
alias giu='git add --update'
compdef _git giu=git-add
alias gid='git diff --no-ext-diff --cached'
compdef _git gid=git-diff
function giD() { git diff --no-ext-diff --cached --ignore-all-space "$@" | view - }
compdef _git giD=git-diff
alias gir='git reset'
compdef _git gir=git-reset
alias giR='git reset --mixed'
compdef _git giR=git-reset
alias gix='git rm -r --cached'
compdef _git gix=git-rm
alias giX='git rm -rf --cached'
compdef _git giX=git-rm
alias gig='git grep --cached'
compdef _git gig=git-grep
# Branah (b)
alias gb='git branch' alias gb='git branch'
compdef _git gb=git-branch compdef _git gb=git-branch
alias gbc='git checkout -b' alias gbc='git checkout -b'
@ -91,19 +45,7 @@ alias gcs='git show'
compdef _git gcs=git-show compdef _git gcs=git-show
alias gcv='git fsck | awk '\''/dangling commit/ {print $3}'\'' | git show --format="SHA1: %C(green)%h%C(reset) %f" --stdin | awk '\''/SHA1/ {sub("SHA1: ", ""); print}'\''' alias gcv='git fsck | awk '\''/dangling commit/ {print $3}'\'' | git show --format="SHA1: %C(green)%h%C(reset) %f" --stdin | awk '\''/SHA1/ {sub("SHA1: ", ""); print}'\'''
# Conflict (k) # Data (d)
alias gkl='git status | sed -n "s/^.*both [a-z]*ed: *//p"'
alias gka='git add $(gkl)'
compdef _git gka=git-add
alias gke='git mergetool $(gkl)'
alias gko='git checkout --ours --'
compdef _git gko=git-checkout
alias gkO='gko $(gkl)'
alias gkt='git checkout --theirs --'
compdef _git gkt=git-checkout
alias gkT='gkt $(gkl)'
# File Data (d)
alias gd='git ls-files' alias gd='git ls-files'
compdef _git gd=git-ls-files compdef _git gd=git-ls-files
alias gdc='git ls-files --cached' alias gdc='git ls-files --cached'
@ -118,6 +60,72 @@ alias gdk='git ls-files --killed'
compdef _git gdk=git-ls-files compdef _git gdk=git-ls-files
alias gdi='git status --porcelain --short --ignored | sed -n "s/^!! //p"' alias gdi='git status --porcelain --short --ignored | sed -n "s/^!! //p"'
# Fetch (f)
alias gf='git fetch'
compdef _git gf=git-fetch
alias gfc='git clone'
compdef _git gfc=git-clone
alias gfm='git pull'
compdef _git gfm=git-pull
alias gfr='git pull --rebase'
compdef _git gfr=git-pull
# Index (i)
alias gia='git add'
compdef _git gia=git-add
alias giA='git add --patch'
compdef _git giA=git-add
alias giu='git add --update'
compdef _git giu=git-add
alias gid='git diff --no-ext-diff --cached'
compdef _git gid=git-diff
function giD() { git diff --no-ext-diff --cached --ignore-all-space "$@" | view - }
compdef _git giD=git-diff
alias gir='git reset'
compdef _git gir=git-reset
alias giR='git reset --mixed'
compdef _git giR=git-reset
alias gix='git rm -r --cached'
compdef _git gix=git-rm
alias giX='git rm -rf --cached'
compdef _git giX=git-rm
alias gig='git grep --cached'
compdef _git gig=git-grep
# Konflict (k)
alias gkl='git status | sed -n "s/^.*both [a-z]*ed: *//p"'
alias gka='git add $(gkl)'
compdef _git gka=git-add
alias gke='git mergetool $(gkl)'
alias gko='git checkout --ours --'
compdef _git gko=git-checkout
alias gkO='gko $(gkl)'
alias gkt='git checkout --theirs --'
compdef _git gkt=git-checkout
alias gkT='gkt $(gkl)'
# Log (l)
git_log_format_oneline='--pretty=format:%C(green)%h%C(reset) %s%C(red)%d%C(reset)'
git_log_format_oneline_more='--pretty=format:%C(green)%h%C(reset) %C(blue)%ad%C(reset) %s%C(red)%d%C(reset) [%C(magenta)%an%C(reset)]'
git_log_format_medium='--pretty=format:%C(green)Commit: %H%C(red)%d%C(reset)%n%C(magenta)Author: %an <%ae>%C(reset)%n%C(blue)Date: %cd%C(reset)%n%+s%n%+b'
alias gl='git log'
compdef _git gl=git-log
alias glo='git log --topo-order ${git_log_format_oneline}'
compdef _git glo=git-log
alias glO='git log --topo-order --date=short ${git_log_format_oneline_more}'
compdef _git glO=git-log
alias glg='git log --topo-order --all --graph ${git_log_format_oneline}'
compdef _git glg=git-log
alias glG='git log --topo-order --all --graph --date=short ${git_log_format_oneline_more}'
compdef _git glG=git-log
alias gls='git log --topo-order --stat ${git_log_format_medium}'
compdef _git gls=git-log
alias gld='git log --topo-order --stat --patch --full-diff ${git_log_format_medium}'
compdef _git gld=git-log
alias glc='git shortlog --summary --numbered'
compdef _git glc=git-shortlog
# Merge (m) # Merge (m)
alias gm='git merge' alias gm='git merge'
compdef _git gm=git-merge compdef _git gm=git-merge
@ -130,17 +138,7 @@ compdef _git gma=git-merge
alias gmt='git mergetool' alias gmt='git mergetool'
compdef _git gmt=git-mergetool compdef _git gmt=git-mergetool
# Pull # Push (p)
alias gf='git fetch'
compdef _git gf=git-fetch
alias gfc='git clone'
compdef _git gfc=git-clone
alias gfm='git pull'
compdef _git gfm=git-pull
alias gfr='git pull --rebase'
compdef _git gfr=git-pull
# Push
alias gp='git push' alias gp='git push'
compdef _git gp=git-push compdef _git gp=git-push
alias gpf='git push --force' alias gpf='git push --force'
@ -167,81 +165,85 @@ compdef _git gri=git-rebase
alias grs='git rebase --skip' alias grs='git rebase --skip'
compdef _git grs=git-rebase compdef _git grs=git-rebase
# Remote Host (h) # Remote (R)
alias gh='git remote' alias gR='git remote'
compdef _git gh=git-remote compdef _git gh=git-remote
alias ghl='git remote --verbose' alias gRl='git remote --verbose'
compdef _git ghl=git-remote compdef _git gRl=git-remote
alias gha='git remote add' alias gRa='git remote add'
compdef _git gha=git-remote compdef _git gRa=git-remote
alias ghx='git remote rm' alias gRx='git remote rm'
compdef _git ghx=git-remote compdef _git gRx=git-remote
alias ghm='git remote rename' alias gRm='git remote rename'
compdef _git ghm=git-remote compdef _git gRm=git-remote
alias ghu='git remote update' alias gRu='git remote update'
compdef _git ghu=git-remote compdef _git gRu=git-remote
alias ghc='git remote prune' alias gRc='git remote prune'
compdef _git ghc=git-remote compdef _git gRc=git-remote
alias ghs='git remote show' alias gRs='git remote show'
compdef _git ghs=git-remote compdef _git gRs=git-remote
alias ghb='git-hub' alias gRb='git-hub'
compdef _git-hub ghb=git-hub compdef _git-hub gRb=git-hub
# Stash (t) # Stash (s)
alias gta='git stash apply' alias gs='git stash'
compdef _git gta=git-stash compdef _git gs=git-stash
alias gtc='git stash clear' alias gsa='git stash apply'
compdef _git gtc=git-stash compdef _git gsa=git-stash
alias gtx='git stash drop' alias gsc='git stash clear'
compdef _git gtx=git-stash compdef _git gsc=git-stash
alias gtl='git stash list' alias gsx='git stash drop'
compdef _git gtl=git-stash compdef _git gsx=git-stash
alias gtL='git stash show --patch --stat' alias gsl='git stash list'
compdef _git gtL=git-stash compdef _git gsl=git-stash
alias gtp='git stash pop' alias gsL='git stash show --patch --stat'
compdef _git gtp=git-stash compdef _git gsL=git-stash
alias gts='git stash save' alias gsp='git stash pop'
compdef _git gts=git-stash compdef _git gsp=git-stash
alias gtS='git stash save --patch --no-keep-index' alias gss='git stash save'
compdef _git gtS=git-stash compdef _git gss=git-stash
alias gsS='git stash save --patch --no-keep-index'
compdef _git gsS=git-stash
# Submodule (u) # Submodule (S)
alias gu='git submodule' alias gS='git submodule'
compdef _git gu=git-submodule compdef _git gS=git-submodule
alias gua='git submodule add' alias gSa='git submodule add'
compdef _git gua=git-submodule compdef _git gSa=git-submodule
alias guf='git submodule foreach' alias gSf='git submodule foreach'
compdef _git guf=git-submodule compdef _git gSf=git-submodule
alias gui='git submodule init' alias gSi='git submodule init'
compdef _git gui=git-submodule compdef _git gSi=git-submodule
alias gul='git submodule status' alias gSl='git submodule status'
compdef _git gul=git-submodule compdef _git gSl=git-submodule
alias gus='git submodule sync' alias gSs='git submodule sync'
compdef _git gus=git-submodule compdef _git gSs=git-submodule
alias guu='git submodule update' alias gSu='git submodule update'
compdef _git guu=git-submodule compdef _git gSu=git-submodule
alias guU='git submodule update --init --recursive' alias gSU='git submodule update --init --recursive'
compdef _git guU=git-submdoule compdef _git gSU=git-submdoule
# Git log (pretty). # Working Copy (w)
git_log_format_oneline='--pretty=format:%C(green)%h%C(reset) %s%C(red)%d%C(reset)' alias gws='git status --short'
git_log_format_oneline_more='--pretty=format:%C(green)%h%C(reset) %C(blue)%ad%C(reset) %s%C(red)%d%C(reset) [%C(magenta)%an%C(reset)]' compdef _git gws=git-status
git_log_format_medium='--pretty=format:%C(green)Commit: %H%C(red)%d%C(reset)%n%C(magenta)Author: %an <%ae>%C(reset)%n%C(blue)Date: %cd%C(reset)%n%+s%n%+b' alias gwS='git status'
compdef _git gwS=git-status
alias gl='git log' alias gwd='git diff --no-ext-diff'
compdef _git gl=git-log compdef _git gwd=git-diff
alias glo='git log --topo-order ${git_log_format_oneline}' function gwD() { git diff --no-ext-diff --ignore-all-space "$@" | view - }
compdef _git glo=git-log compdef _git gwD=git-diff
alias glO='git log --topo-order --date=short ${git_log_format_oneline_more}' alias gwr='git reset --soft'
compdef _git glO=git-log compdef _git gwr=git-reset
alias glg='git log --topo-order --all --graph ${git_log_format_oneline}' alias gwR='git reset --hard'
compdef _git glg=git-log compdef _git gwR=git-reset
alias glG='git log --topo-order --all --graph --date=short ${git_log_format_oneline_more}' alias gwc='git clean -n'
compdef _git glG=git-log compdef _git gwc=git-clean
alias gls='git log --topo-order --stat ${git_log_format_medium}' alias gwC='git clean -f'
compdef _git gls=git-log compdef _git gwC=git-clean
alias gld='git log --topo-order --stat --patch --full-diff ${git_log_format_medium}' alias gwx='git rm -r'
compdef _git gld=git-log compdef _git gwx=git-rm
alias glc='git shortlog --summary --numbered' alias gwX='git rm -rf'
compdef _git glc=git-shortlog compdef _git gwX=git-rm
alias gwg='git grep'
compdef _git gwg=git-grep