Reworked Git aliases

Signed-off-by: Gaetan Semet <gaetan@xeberon.net>
This commit is contained in:
Gaetan Semet 2013-10-16 15:06:59 +02:00
commit a394bfe8ee

View file

@ -1,12 +1,26 @@
# Aliases
# Common
alias g='git'
compdef g=git
# Git Status (gst)
alias gst='git status'
compdef _git gst=git-status
# Git Diff (gd)
alias gd='git diff'
compdef _git gd=git-diff
alias gdc='git diff --cached'
compdef _git gdc=git-diff
alias gd='git diff --color'
compdef _git gd=git-diff
gdv() { git diff -w "$@" | view - }
compdef _git gdv=git-diff
alias gdc='git diff --cached'
compdef _git gdc=git-diff
# Git Pull (gl)
alias gl='git pull'
compdef _git gl=git-pull
alias gch='git fetch'
@ -17,16 +31,14 @@ alias gpr='git pull --rebase'
compdef _git gpr=git-pull
alias gp='git push'
compdef _git gp=git-push
# Git Fetch (gf)
alias gf='git fetch'
compdef _git gf='git-fetch'
alias gfa='git fetch --all'
compdef _git gfa='git-fetch'
alias gd='git diff --color'
compdef _git gd=git-diff
gdv() { git diff -w "$@" | view - }
compdef _git gdv=git-diff
alias gdc='git diff --cached'
compdef _git gdc=git-diff
# Git Commit (gc)
alias gc='git commit -v'
compdef _git gc=git-commit
alias gc!='git commit -v --amend'
@ -37,12 +49,16 @@ alias gca!='git commit -v -a --amend'
compdef _git gca!=git-commit
alias gcmsg='git commit -m'
compdef _git gcmsg=git-commit
# Git Checkout
alias gco='git checkout'
compdef _git gco=git-checkout
alias gcm='git checkout master'
compdef _git gcm=git-checkout
alias grm='git rebase master'
compdef _git grm=git-rebase
# Git Remote (gre)
alias gre='git remote'
compdef _git gre=git-remote
alias grev='git remote -v'
@ -55,22 +71,24 @@ alias greset='git remote set-url'
compdef _git greset=git-remote
alias greup='git remote update'
compdef _git greset=git-remote
# Git Rebase (gr)
alias gr='git rebase -i'
compdef _git gr=git-rebase
alias grc='git rebase --continue'
compdef _git grc=git-rebase
alias gra='git rebase --abort'
compdef _git gra=git-rebase
alias grs='git rebase --skip'
compdef _git grs=git-rebase
# Git Branch (bb)
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 gcl='git config --list'
compdef _git gcl=git-config
alias gcp='git cherry-pick'
compdef _git gcp=git-cherry-pick
# Git Log (gl)
alias glg='git log --stat --max-count=10'
compdef _git glg=git-log
alias glgg='git log --graph --max-count=10'
@ -83,16 +101,27 @@ alias glgga='git log --graph --decorate --all'
compdef _git glgga=git-log
alias glo='git log --oneline'
compdef _git glo=git-log
# Git Reset (grh)
alias grh='git reset HEAD'
compdef _git grh=git-reset
alias grhh='git reset HEAD --hard'
compdef _git grhh=git-reset
# Other
alias gcount='git shortlog -sn'
compdef gcount=git
alias gcl='git config --list'
compdef _git gcl=git-config
alias gcp='git cherry-pick'
compdef _git gcp=git-cherry-pick
alias gss='git status -s'
compdef _git gss=git-status
alias ga='git add'
compdef _git ga=git-add
alias gm='git merge'
compdef _git gm=git-merge
alias grh='git reset HEAD'
compdef _git grh=git-reset
alias grhh='git reset HEAD --hard'
compdef _git grhh=git-reset
alias gwc='git whatchanged -p --abbrev-commit --pretty=medium'
compdef _git gwc=git-whatchanged
alias gls='git ls-files | grep'
@ -105,26 +134,33 @@ compdef _git gmt=git-mergetool
alias gmtvim='git mergetool --no-prompt --tool=vimdiff'
compdef _git gmtvim=git-mergetool
# Git stash (gst)
alias gsts='git stash show --text'
compdef _git gsts='git-stash'
alias gstp='git stash pop'
compdef _git gstp='git-stash'
alias gsta='git stash apply'
compdef _git gstz='git-stash'
alias gst='git stash'
compdef _git gst='git-stash'
alias gstd='git stash drop'
compdef _git gstd='git-stash'
# Git Gui (gg)
alias gg='git gui citool'
compdef _git gg='git gui'
alias gga='git gui citool --amend'
compdef _git gga='git gui citool --amend'
# Gitk
alias gk='gitk --all --branches'
compdef _git gk='gitk'
alias gsts='git stash show --text'
compdef _git gsts='git-stash'
alias gitk-entier-history='gitk --all $(git log -g --pretty=format:%h)' # show complete history, with dangling commits
compdef _git gitk='gitk'
# Note: if the commit has been cleaned my 'git gc', the dangling commits older than 2 weeks may have been deleted
#
alias gstst='git stash show --text'
alias gsts='git stash'
alias gstsp='git stash pop'
alias gstsd='git stash drop'
alias gstsa='git stash apply'
alias gstsl='git stash list'
#lias gstsd='git stash drop'
# Edit global Git configuration files
alias gitconfig="vim ~/.gitconfig"
alias gitmessage="vim ~/.gitmessage"
@ -136,6 +172,7 @@ alias grt='cd $(git rev-parse --show-toplevel || echo ".")'
alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk'
compdef git-svn-dcommit-push=git
# Git SVN
alias gsr='git svn rebase'
compdef _git gsr='git-svn'
alias gsd='git svn dcommit'