]>
git.rmz.io Git - dotfiles.git/blob - zsh/aliases/git.zsh
1e6c91e9baafda0ecefa94be0930e0e66f6c6a1b
5 alias gsts
='git status -s'
8 alias gup
='git pull --rebase'
11 alias gpf
='git push --force-with-lease'
14 alias gdc
='git diff --cached'
15 function gdm
{ gd
"${1:-origin}"..
}
16 compdef _git gdm
=git
-diff
18 alias gc
='git commit -v'
19 alias gcs
='git commit -v --squash'
20 alias gcf
='git commit -v --fixup'
21 alias gca
='git commit -v -a'
22 alias gcaf
='git commit -v -a --fixup'
24 alias gco
='git checkout'
25 alias gcm
='git checkout master'
27 alias gs
='git stash save'
28 alias gsa
='git stash apply'
29 alias gsp
='git stash pop'
30 alias gsd
='git stash drop'
31 alias gsl
='git --no-pager log -g --oneline --pretty=tformat:"%gd %Cblue%cd %C(auto)%h %s" stash@{0} --date=short'
32 alias gss
='git stash show --patch'
35 alias grv
='git remote -v'
36 alias grmv
='git remote rename'
37 alias grrm
='git remote remove'
38 alias grset
='git remote set-url'
39 alias grup
='git remote update'
41 alias gb
='git --no-pager branch'
42 alias gbv
='git --no-pager branch -vv'
43 alias gba
='git --no-pager branch -a'
44 alias gbm
='git --no-pager branch --merged'
45 alias gbdm
='git branch --merged | grep -ve "\*" -e "master" | xargs git branch -d'
47 alias gcl
='git config --list'
48 alias gcp
='git cherry-pick'
50 alias gcount
='git shortlog -sn'
51 alias glg
='git --no-pager log --graph --max-count=20 --format="%Cblue%cd %C(auto)%h%d %s" --date=short'
52 alias glg2
='git --no-pager log --graph --max-count=20 --date=short --format="%C(blue)%cd %C(auto)%h %C(dim cyan)%an %C(bold green)(%ar)%C(auto)%-d%n %s"'
53 function glm
{ glg
"${1:-origin}"..
}
54 compdef _git glm
=git
-log
55 alias glgl
='git log --graph --cherry-mark --boundary --pretty=tformat:"%Cblue%cd %C(auto)%h%d %s" --date=short'
56 alias glgg
='git log --stat --graph --max-count=20 --decorate'
57 alias glgga
='git log --stat --graph --decorate --all'
59 alias grl
='git --no-pager reflog --max-count=20'
65 alias grh
='git reset HEAD'
66 alias grhh
='git reset HEAD --hard'
68 alias gwc
='git whatchanged -p --abbrev-commit --pretty=medium'
70 alias gf
='git ls-files | grep'
72 alias gpoat
='git push origin --all && git push origin --tags'
74 # cd into the top of the current repository
76 alias cdr
='cd $(git rev-parse --show-toplevel || echo ".")'
79 alias git
-svn-dcommit-push='git svn dcommit && git push github master:svntrunk'
81 alias gsr
='git svn rebase'
82 alias gsd
='git svn dcommit'
84 # return the current branch name
85 # Usage example: git pull origin $(current_branch)
86 function current_branch
() {
87 ref
=$(git symbolic-ref HEAD 2> /dev/null) || \
88 ref
=$(git rev-parse --short HEAD 2> /dev/null) || return
89 echo ${ref#refs/heads/}
92 function current_repository
() {
93 ref
=$(git symbolic-ref HEAD 2> /dev/null) || \
94 ref
=$(git rev-parse --short HEAD 2> /dev/null) || return
95 echo $(git remote -v | cut -d':' -f 2)
98 # these aliases take advantage of the previous function
99 alias ggpull
='git pull origin $(current_branch)'
100 alias ggpush
='git push origin $(current_branch)'
101 alias ggpnp
='git pull origin $(current_branch) && git push origin $(current_branch)'