From 5c103b5675c663d6fd7107cc77527323bd7ff7d1 Mon Sep 17 00:00:00 2001 From: Gaetan Semet Date: Mon, 15 Jul 2013 15:08:57 +0200 Subject: [PATCH] Fix aliases for git and repo This also adds the wonderful "gitk-entier-history" alias to display the entiere git history with dangling commits. Signed-off-by: Gaetan Semet --- plugins/git/git.plugin.zsh | 48 ++++++++++++++++++++++++++++++++---- plugins/repo/repo.plugin.zsh | 10 ++++++++ 2 files changed, 53 insertions(+), 5 deletions(-) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 2ecc74eb6..76ec5819e 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -7,24 +7,40 @@ alias gd='git diff' compdef _git gd=git-diff alias gl='git pull' compdef _git gl=git-pull +alias gch='git fetch' +compdef _git gch=git-fetch alias gup='git pull --rebase' -compdef _git gup=git-fetch +compdef _git gup=git-pull +alias gpr='git pull --rebase' +compdef _git gpr=git-pull alias gp='git push' compdef _git gp=git-push alias gd='git diff' +compdef _git gd=git-diff +alias gf='git fetch --all' +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 alias gc='git commit -v' compdef _git gc=git-commit alias gc!='git commit -v --amend' compdef _git gc!=git-commit alias gca='git commit -v -a' -compdef _git gc=git-commit +compdef _git gca=git-commit alias gca!='git commit -v -a --amend' compdef _git gca!=git-commit 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 alias gr='git remote' compdef _git gr=git-remote alias grv='git remote -v' @@ -50,11 +66,12 @@ 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 -alias glg='git log --stat --max-count=5' +alias glg='git log --stat --max-count=5 --color' compdef _git glg=git-log -alias glgg='git log --graph --max-count=5' +alias glgg='git log --graph --max-count=5 --color' compdef _git glgg=git-log alias glgga='git log --graph --decorate --all' compdef _git glgga=git-log @@ -67,18 +84,36 @@ 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 gclean='git reset --hard && git clean -dfx' +compdef _git grhh=git-reset alias gwc='git whatchanged -p --abbrev-commit --pretty=medium' +compdef _git gwc=git-whatchanged alias gf='git ls-files | grep' +compdef _git gwc=git-whatchanged +alias gls='git ls-files | grep' +compdef _git gls=git-ls-files alias gpoat='git push origin --all && git push origin --tags' +compdef _git gpoat=git-push alias gmt='git mergetool --no-prompt' -compdef _git gm=git-mergetool +compdef _git gmt=git-mergetool alias gg='git gui citool' +compdef _git gg='git gui' alias gga='git gui citool --amend' +compdef _git gga='git gui citool --amend' 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 gitconfig="vim ~/.gitconfig" +alias gitmessage="vim ~/.gitmessage" # Will cd into the top of the current repository # or submodule. @@ -89,7 +124,10 @@ alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk' compdef git-svn-dcommit-push=git alias gsr='git svn rebase' +compdef _git gsr='git-svn' alias gsd='git svn dcommit' +compdef _git gsd='git-svn' + # # Will return the current branch name # Usage example: git pull origin $(current_branch) diff --git a/plugins/repo/repo.plugin.zsh b/plugins/repo/repo.plugin.zsh index 9cc336959..d690a9d22 100644 --- a/plugins/repo/repo.plugin.zsh +++ b/plugins/repo/repo.plugin.zsh @@ -1,2 +1,12 @@ # Aliases alias r='repo' +compdef _repo r=repo + +alias rra='repo rebase --auto-stash' +compdef _repo rra='repo rebase --auto-stash' + +alias rs='repo sync' +compdef _repo rs='repo sync' + +alias rsrra='repo sync ; repo rebase --auto-stash' +compdef _repo rsrra='repo sync ; repo rebase --auto-stash'