]>
git.rmz.io Git - dotfiles.git/blob - zsh/aliases/git.zsh
5 alias gsts
='git status -s'
8 alias gup
='git pull --rebase'
11 alias gpf
='git push --force-with-lease'
13 alias gpfo
='gpf origin'
16 alias gdc
='git diff --cached'
17 function gdm
{ gd
"${1:-origin}"..
}
18 compdef _git gdm
=git
-diff
19 function gdf
{ gd
$(git merge-base --fork-point $1) }
20 compdef _git gdf
=git
-diff
22 alias gc
='git commit -v'
23 alias gcs
='git commit -v --squash'
24 alias gcf
='git commit -v --fixup'
25 alias gca
='git commit -v -a'
26 alias gcaf
='git commit -v -a --fixup'
28 alias gco
='git checkout'
29 alias gcm
='git checkout master'
31 alias gs
='git stash save'
32 alias gsa
='git stash apply'
33 alias gsp
='git stash pop'
34 alias gsd
='git stash drop'
35 alias gsl
='git --no-pager log -g --oneline --pretty=tformat:"%gd %Cblue%cd %C(auto)%h %s" stash@{0} --date=short'
36 alias gss
='git stash show --patch'
39 alias grv
='git remote -v'
40 alias grmv
='git remote rename'
41 alias grrm
='git remote remove'
42 alias grset
='git remote set-url'
43 alias grup
='git remote update'
45 alias gb
='git --no-pager branch -vv'
46 alias gbv
='git --no-pager branch -vv'
47 alias gba
='git --no-pager branch -a'
48 alias gbm
='git --no-pager branch -vv --merged'
49 alias gbdm
='git branch --merged | grep -ve "\*" -e "\+" -e "master" | xargs git branch -d'
50 alias gsu
='git branch --set-upstream-to'
51 alias gsum
='git branch --set-upstream-to=origin/HEAD'
53 alias gwl
='git worktree list'
54 function gwa
{ git worktree add wt
/$1 $1 }
55 compdef
-e '__git_remote_branch_names_noprefix' gwa
57 alias gcl
='git config --list'
58 alias gcp
='git cherry-pick'
60 alias gcount
='git shortlog -sn'
61 alias glg
='git --no-pager log --graph --max-count=20 --format="%Cblue%cd %C(auto)%h%d %s" --date=short'
62 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"'
63 function glm
{ glg
"${1:-origin}"..
}
64 compdef _git glm
=git
-log
65 alias glgl
='git log --graph --cherry-mark --boundary --pretty=tformat:"%Cblue%cd %C(auto)%h%d %s" --date=short'
66 alias glgg
='git log --stat --graph --max-count=20 --decorate'
67 alias glgga
='git log --stat --graph --decorate --all'
69 alias grl
='git --no-pager reflog --max-count=20'
75 alias grh
='git reset HEAD'
76 alias grhh
='git reset HEAD --hard'
78 alias gwc
='git whatchanged -p --abbrev-commit --pretty=medium'
80 alias gf
='git ls-files | grep'
82 alias gpoat
='git push origin --all && git push origin --tags'
84 # cd into the top of the current repository
86 alias cdr
='cd $(git rev-parse --show-toplevel || echo ".")'
89 alias git
-svn-dcommit-push='git svn dcommit && git push github master:svntrunk'
91 alias gsr
='git svn rebase'
92 alias gsd
='git svn dcommit'
94 # return the current branch name
95 # Usage example: git pull origin $(current_branch)
96 function current_branch
() {
97 ref
=$(git symbolic-ref HEAD 2> /dev/null) || \
98 ref
=$(git rev-parse --short HEAD 2> /dev/null) || return
99 echo ${ref#refs/heads/}
102 function current_repository
() {
103 ref
=$(git symbolic-ref HEAD 2> /dev/null) || \
104 ref
=$(git rev-parse --short HEAD 2> /dev/null) || return
105 echo $(git remote -v | cut -d':' -f 2)
108 # these aliases take advantage of the previous function
109 alias ggpull
='git pull origin $(current_branch)'
110 alias ggpush
='git push origin $(current_branch)'
111 alias ggpnp
='git pull origin $(current_branch) && git push origin $(current_branch)'