@@ -2,6 +2,7 @@ cite 'about-alias'
22about-alias ' common git abbreviations'
33
44alias g=' git'
5+ alias get=' git'
56
67# add
78alias ga=' git add'
@@ -17,7 +18,7 @@ alias gbm='git branch -m'
1718alias gbt=' git branch --track'
1819alias gdel=' git branch -D'
1920
20- # odds and ends
21+ # for-each-ref
2122alias gbc=' git for-each-ref --format="%(authorname) %09 %(if)%(HEAD)%(then)*%(else)%(refname:short)%(end) %09 %(creatordate)" refs/remotes/ --sort=authorname DESC' # FROM https://stackoverflow.com/a/58623139/10362396
2223
2324# commit
@@ -39,10 +40,11 @@ alias gcom='git checkout master'
3940alias gcpd=' git checkout master; git pull; git branch -D'
4041alias gct=' git checkout --track'
4142
42- # odds and ends
43+ # clone
4344alias gcl=' git clone'
45+
46+ # clean
4447alias gclean=' git clean -fd'
45- alias gcount=' git shortlog -sn'
4648
4749# cherry-pick
4850alias gcp=' git cherry-pick'
@@ -53,10 +55,7 @@ alias gd='git diff'
5355alias gds=' git diff --staged'
5456alias gdt=' git difftool'
5557
56- # Another Git alias
57- alias get=' git'
58-
59- # odds and ends
58+ # archive
6059alias gexport=' git archive --format zip --output'
6160
6261# fetch
@@ -65,19 +64,36 @@ alias gft='git fetch --all --prune --tags'
6564alias gftv=' git fetch --all --prune --tags --verbose'
6665alias gfv=' git fetch --all --prune --verbose'
6766alias gmu=' git fetch origin -v; git fetch upstream -v; git merge upstream/master'
67+ alias gup=' git fetch && git rebase'
6868
6969# log
7070alias gg=' git log --graph --pretty=format:' \' ' %C(bold)%h%Creset%C(magenta)%d%Creset %s %C(yellow)<%an> %C(cyan)(%cr)%Creset' \' ' --abbrev-commit --date=relative'
7171alias ggf=' git log --graph --date=short --pretty=format:' \' ' %C(auto)%h %Cgreen%an%Creset %Cblue%cd%Creset %C(auto)%d %s' \' ' '
7272alias ggs=' gg --stat'
7373alias gll=' git log --graph --pretty=oneline --abbrev-commit'
7474alias gnew=' git log HEAD@{1}..HEAD@{0}' # Show commits since last pull, see http://blogs.atlassian.com/2014/10/advanced-git-aliases/
75+ alias gwc=' git whatchanged'
76+
77+ # ls-files
78+ alias gu=' git ls-files . --exclude-standard --others' # Show untracked files
7579
76- # odds and ends
80+ # gui
7781alias ggui=' git gui'
82+
83+ # home
7884alias ghm=' cd ' \' ' $(git rev-parse --show-toplevel)' \' ' ' # Git home
85+ # appendage to ghm
86+ if ! _command_exists gh; then
87+ alias gh=' ghm'
88+ fi
89+
90+ # merge
7991alias gm=' git merge'
92+
93+ # mv
8094alias gmv=' git mv'
95+
96+ # patch
8197alias gpatch=' git format-patch -1'
8298
8399# push
@@ -98,31 +114,37 @@ alias gpl='git pull'
98114alias gpp=' git pull && git push'
99115alias gpr=' git pull --rebase'
100116
101- # odds and ends
102- alias gpristine=' git reset --hard && git clean -dfx'
103- alias gprom=' git fetch origin master && git rebase origin/master && git update-ref refs/heads/master origin/master' # Rebase with latest remote master
104-
105117# remote
106118alias gr=' git remote'
107119alias gra=' git remote add'
108120alias grv=' git remote -v'
109121
110- # odds and ends
122+ # rm
111123alias grm=' git rm'
112124
113125# rebase
114126alias grb=' git rebase'
115127alias grm=' git rebase master'
116128alias grmi=' git rebase master -i'
129+ alias gprom=' git fetch origin master && git rebase origin/master && git update-ref refs/heads/master origin/master' # Rebase with latest remote master
130+
131+ # reset
132+ alias gus=' git reset HEAD'
133+ alias gpristine=' git reset --hard && git clean -dfx'
117134
118135# status
119136alias gs=' git status'
120137alias gss=' git status -s'
121138
122- # odds and ends
123- alias gsd=' git svn dcommit'
124- alias gsh=' git show'
139+ # shortlog
140+ alias gcount=' git shortlog -sn'
125141alias gsl=' git shortlog -sn'
142+
143+ # show
144+ alias gsh=' git show'
145+
146+ # svn
147+ alias gsd=' git svn dcommit'
126148alias gsr=' git svn rebase' # Git SVN
127149
128150# stash
@@ -141,7 +163,7 @@ alias gstpum='git stash push -m'
141163alias gsts=' git stash push'
142164alias gstsm=' git stash push -m'
143165
144- # odds and ends
166+ # submodules
145167alias gsu=' git submodule update --init --recursive'
146168
147169# switch
@@ -157,18 +179,6 @@ alias gta='git tag -a'
157179alias gtd=' git tag -d'
158180alias gtl=' git tag -l'
159181
160- # odds and ends
161- alias gu=' git ls-files . --exclude-standard --others' # Show untracked files
162- alias gup=' git fetch && git rebase'
163- alias gus=' git reset HEAD'
164- alias gwc=' git whatchanged'
165-
166- # appendage to ghm
167- # it's here as there is a command called gh on some machines
168- if ! _command_exists gh; then
169- alias gh=' ghm'
170- fi
171-
172182case $OSTYPE in
173183 darwin* )
174184 alias gtls=" git tag -l | gsort -V"
@@ -179,6 +189,6 @@ case $OSTYPE in
179189esac
180190
181191# functions
182- gdv () {
192+ function gdv() {
183193 git diff --ignore-all-space " $@ " | vim -R -
184194}
0 commit comments