Skip to content

Commit c3a01db

Browse files
author
Noah Gorny
committed
aliases: git: Sort all commands, even miniscule ones
1 parent c03c219 commit c3a01db

File tree

1 file changed

+40
-30
lines changed

1 file changed

+40
-30
lines changed

aliases/available/git.aliases.bash

Lines changed: 40 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ cite 'about-alias'
22
about-alias 'common git abbreviations'
33

44
alias g='git'
5+
alias get='git'
56

67
# add
78
alias ga='git add'
@@ -17,7 +18,7 @@ alias gbm='git branch -m'
1718
alias gbt='git branch --track'
1819
alias gdel='git branch -D'
1920

20-
# odds and ends
21+
# for-each-ref
2122
alias 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'
3940
alias gcpd='git checkout master; git pull; git branch -D'
4041
alias gct='git checkout --track'
4142

42-
# odds and ends
43+
# clone
4344
alias gcl='git clone'
45+
46+
# clean
4447
alias gclean='git clean -fd'
45-
alias gcount='git shortlog -sn'
4648

4749
# cherry-pick
4850
alias gcp='git cherry-pick'
@@ -53,10 +55,7 @@ alias gd='git diff'
5355
alias gds='git diff --staged'
5456
alias gdt='git difftool'
5557

56-
# Another Git alias
57-
alias get='git'
58-
59-
# odds and ends
58+
# archive
6059
alias gexport='git archive --format zip --output'
6160

6261
# fetch
@@ -65,19 +64,36 @@ alias gft='git fetch --all --prune --tags'
6564
alias gftv='git fetch --all --prune --tags --verbose'
6665
alias gfv='git fetch --all --prune --verbose'
6766
alias gmu='git fetch origin -v; git fetch upstream -v; git merge upstream/master'
67+
alias gup='git fetch && git rebase'
6868

6969
# log
7070
alias 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'
7171
alias ggf='git log --graph --date=short --pretty=format:'\''%C(auto)%h %Cgreen%an%Creset %Cblue%cd%Creset %C(auto)%d %s'\'''
7272
alias ggs='gg --stat'
7373
alias gll='git log --graph --pretty=oneline --abbrev-commit'
7474
alias 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
7781
alias ggui='git gui'
82+
83+
# home
7884
alias 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
7991
alias gm='git merge'
92+
93+
# mv
8094
alias gmv='git mv'
95+
96+
# patch
8197
alias gpatch='git format-patch -1'
8298

8399
# push
@@ -98,31 +114,37 @@ alias gpl='git pull'
98114
alias gpp='git pull && git push'
99115
alias 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
106118
alias gr='git remote'
107119
alias gra='git remote add'
108120
alias grv='git remote -v'
109121

110-
# odds and ends
122+
# rm
111123
alias grm='git rm'
112124

113125
# rebase
114126
alias grb='git rebase'
115127
alias grm='git rebase master'
116128
alias 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
119136
alias gs='git status'
120137
alias 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'
125141
alias gsl='git shortlog -sn'
142+
143+
# show
144+
alias gsh='git show'
145+
146+
# svn
147+
alias gsd='git svn dcommit'
126148
alias gsr='git svn rebase' # Git SVN
127149

128150
# stash
@@ -141,7 +163,7 @@ alias gstpum='git stash push -m'
141163
alias gsts='git stash push'
142164
alias gstsm='git stash push -m'
143165

144-
# odds and ends
166+
# submodules
145167
alias gsu='git submodule update --init --recursive'
146168

147169
# switch
@@ -157,18 +179,6 @@ alias gta='git tag -a'
157179
alias gtd='git tag -d'
158180
alias 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-
172182
case $OSTYPE in
173183
darwin*)
174184
alias gtls="git tag -l | gsort -V"
@@ -179,6 +189,6 @@ case $OSTYPE in
179189
esac
180190

181191
# functions
182-
gdv() {
192+
function gdv() {
183193
git diff --ignore-all-space "$@" | vim -R -
184194
}

0 commit comments

Comments
 (0)