]> git.rmz.io Git - dotfiles.git/blob - zsh/aliases/git.zsh
dwb: update forms
[dotfiles.git] / zsh / aliases / git.zsh
1 # Aliases
2 alias g='git'
3 compdef g=git
4 alias gst='git status'
5 compdef _git gst=git-status
6 alias gl='git pull'
7 compdef _git gl=git-pull
8 alias gup='git pull --rebase'
9 compdef _git gup=git-fetch
10 alias gp='git push'
11 compdef _git gp=git-push
12 alias gd='git diff'
13 alias gdc='git diff --cached'
14 alias gc='git commit -v'
15 compdef _git gc=git-commit
16 alias gcs='git commit -v --squash'
17 compdef _git gcs=git-commit
18 alias gcf='git commit -v --fixup'
19 compdef _git gcf=git-commit
20 alias gca='git commit -v -a'
21 compdef _git gca=git-commit
22 alias gco='git checkout'
23 compdef _git gco=git-checkout
24 alias gcm='git checkout master'
25 alias gr='git remote'
26 compdef _git gr=git-remote
27 alias grv='git remote -v'
28 compdef _git grv=git-remote
29 alias grmv='git remote rename'
30 compdef _git grmv=git-remote
31 alias grrm='git remote remove'
32 compdef _git grrm=git-remote
33 alias grset='git remote set-url'
34 compdef _git grset=git-remote
35 alias grup='git remote update'
36 compdef _git grset=git-remote
37 alias gb='git branch'
38 compdef _git gb=git-branch
39 alias gba='git branch -a'
40 compdef _git gba=git-branch
41 alias gcount='git shortlog -sn'
42 compdef gcount=git
43 alias gcl='git config --list'
44 alias gcp='git cherry-pick'
45 compdef _git gcp=git-cherry-pick
46 alias glg='git --no-pager log --oneline --graph --max-count=20 --decorate'
47 alias glg='git --no-pager log --graph --max-count=20 --pretty=tformat:"%Cblue%cd %C(auto)%h%d %s" --date=short'
48 compdef _git glg=git-log
49 alias glgl='git log --graph --pretty=tformat:"%Cblue%cd %C(auto)%h%d %s" --date=short'
50 compdef _git glgl=git-log
51 alias glgg='git log --stat --graph --max-count=20 --decorate'
52 compdef _git glgg=git-log
53 alias glgga='git log --stat --graph --decorate --all'
54 compdef _git glgga=git-log
55 alias gss='git status -s'
56 compdef _git gss=git-status
57 alias ga='git add'
58 compdef _git ga=git-add
59 alias gm='git merge'
60 compdef _git gm=git-merge
61 alias grh='git reset HEAD'
62 alias grhh='git reset HEAD --hard'
63 alias gwc='git whatchanged -p --abbrev-commit --pretty=medium'
64 alias gf='git ls-files | grep'
65 alias gpoat='git push origin --all && git push origin --tags'
66
67 # Will cd into the top of the current repository
68 # or submodule.
69 alias grt='cd $(git rev-parse --show-toplevel || echo ".")'
70
71 # Git and svn mix
72 alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk'
73 compdef git-svn-dcommit-push=git
74
75 alias gsr='git svn rebase'
76 alias gsd='git svn dcommit'
77 #
78 # Will return the current branch name
79 # Usage example: git pull origin $(current_branch)
80 #
81 function current_branch() {
82 ref=$(git symbolic-ref HEAD 2> /dev/null) || \
83 ref=$(git rev-parse --short HEAD 2> /dev/null) || return
84 echo ${ref#refs/heads/}
85 }
86
87 function current_repository() {
88 ref=$(git symbolic-ref HEAD 2> /dev/null) || \
89 ref=$(git rev-parse --short HEAD 2> /dev/null) || return
90 echo $(git remote -v | cut -d':' -f 2)
91 }
92
93 # these aliases take advantage of the previous function
94 alias ggpull='git pull origin $(current_branch)'
95 compdef ggpull=git
96 alias ggpush='git push origin $(current_branch)'
97 compdef ggpush=git
98 alias ggpnp='git pull origin $(current_branch) && git push origin $(current_branch)'
99 compdef ggpnp=git