git.plugin.zsh 1.7 KB
Newer Older
1 2
# Aliases
alias g='git'
3
compdef g=git
4
alias gst='git status'
5
compdef _git gst=git-status
J
Jordan MacDonald 已提交
6 7
alias gd='git diff'
compdef _git diff=git-diff
8
alias gl='git pull'
9
compdef _git gl=git-pull
10
alias gup='git fetch && git rebase'
11
compdef _git gup=git-fetch
12
alias gp='git push'
13
compdef _git gp=git-push
14
gdv() { git-diff -w "$@" | view - }
15
compdef _git gdv=git-diff
16
alias gc='git commit -v'
17
compdef _git gc=git-commit
18
alias gca='git commit -v -a'
19
compdef _git gca=git-commit
H
Hakan Ensari 已提交
20
alias gco='git checkout'
21
compdef _git gco=git-checkout
22
alias gcm='git checkout master'
23
alias gb='git branch'
24
compdef _git gb=git-branch
25
alias gba='git branch -a'
26
compdef _git gba=git-branch
27
alias gcount='git shortlog -sn'
28
compdef gcount=git
29
alias gcp='git cherry-pick'
30
compdef _git gcp=git-cherry-pick
31
alias glg='git log --stat --max-count=5'
32
compdef _git glg=git-log
S
Sven Lito 已提交
33 34
alias glgg='git log --graph --max-count=5'
compdef _git glgg=git-log
M
Mark Szymanski 已提交
35 36
alias gss='git status -s'
compdef _git gss=git-status
37 38
alias ga='git add'
compdef _git ga=git-add
D
Dan Shearmur 已提交
39 40
alias gm='git merge'
compdef _git gm=git-merge
41 42 43

# Git and svn mix
alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk'
44
compdef git-svn-dcommit-push=git
45

S
Sven Lito 已提交
46 47
alias gsr='git svn rebase'
alias gsd='git svn dcommit'
48 49 50 51 52 53 54 55 56
#
# Will return the current branch name
# Usage example: git pull origin $(current_branch)
#
function current_branch() {
  ref=$(git symbolic-ref HEAD 2> /dev/null) || return
  echo ${ref#refs/heads/}
}

H
Typo  
Hakan Ensari 已提交
57
# these aliases take advantage of the previous function
58
alias ggpull='git pull origin $(current_branch)'
59
compdef ggpull=git
60
alias ggpush='git push origin $(current_branch)'
61
compdef ggpush=git
H
Typo  
Hakan Ensari 已提交
62
alias ggpnp='git pull origin $(current_branch) && git push origin $(current_branch)'
63
compdef ggpnp=git