-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaliases
211 lines (179 loc) · 6.15 KB
/
aliases
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
# Reload zshrc
alias sss='source ~/.zshrc'
# Forget Me Not Task Manager
alias tl='fmn list'
alias ta='fmn add'
alias td='fmn done'
alias t='tig'
# Navigation
alias ~='cd ~'
alias o='open'
# git
alias g='git'
alias gb='git branch'
alias gs='nocorrect git status --short'
alias ga='nocorrect git add'
alias gaa='nocorrect git add --all'
alias gc='nocorrect git commit'
alias gcm='nocorrect git commit -m'
alias gcn='git commit --amend --no-edit'
alias gp='nocorrect git push'
alias gl='nocorrect git pull'
alias gh='git checkout'
alias ghp='git checkout -p'
alias gh.='git checkout .'
alias gh-='git checkout -'
# gh is actually the name of GitHub's CLI, but I got 5 years of muscle memory
# using gh as my checkout alias, so here's an alias for GitHub's gh
alias ghb='/usr/local/bin/gh'
alias gnb='git checkout -b'
alias gd='git diff'
alias gdc='git diff --cached'
alias gm='git merge'
alias gr='git rebase'
alias gf='git fetch'
# At iflix, the base branch was always master, in the Automattic mobile
# division it's develop. I wonder if there's a way to read what the base branch
# is from somewhere...
alias gfr='git fetch && git rebase origin/develop'
alias gfrm='git fetch && git rebase origin/master'
alias gt='git tag'
# merge by always making a new commit (--no-ff) and open editor for the commit message (-e)
alias gmm='git merge --no-ff -e'
alias gsp='git submodule foreach git pull'
alias gsu='git submodule update'
alias gcp='git cherry-pick'
alias glgr='git log --oneline --reverse'
alias grbc='git rebase --continue'
alias gsh='git show head'
# See https://coderwall.com/p/euwpig
alias glg="git log \
--graph \
--pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue) %an%Creset' \
--abbrev-commit"
# see above + only show commits made in the the current branch
alias glgf='glg --first-parent'
# I make this typo from time to time on Colemak
alias gjg='glg'
# Hub is a CLI client for the GitHub APIs
# https://github.com/github/hub
alias gpr='hub pull-request --draft'
alias grp=gpr
alias grpn='hub pull-request'
alias cpr='hub pr checkout' # usage `cpr <PR id>`
alias hb='hub browse' # open GitHub for the current repo and branch combo
# Stay safe when git commit -a
safe_command() {
message=$1
shift 1
echo "$message"; echo -n "\e[0;33;49mAre you sure? (y/n) \e[0m"; read ANSWER; if [ $ANSWER = y ]; then $*; fi;
}
message='\e[0;33;49mYou are about to perform a git commit all.\e[0m'
# no correct doesn't work here... why?
gca_cmd='git commit -a'
gcam_cmd='git commit -a -m'
alias gca="safe_command '$message' $gca_cmd"
alias gcam="safe_command '$message' $gcam_cmd"
alias gri="git rebase --interactive"
alias gir=gri
alias gpt="git push; git push --tags"
alias gap="git add -p"
alias gchp="git checkout -p"
# List the 10 most recent branches
alias grb="git branch --sort=committerdate | tail -10 | more"
# Custom script to interactively stash files
# TODO: this needs to be parametric, can't depend on an hardcoded path
alias gsa="ruby $DOTFILES_HOME/scripts/interactive-stage.rb"
# Custom script to cherry-pick commits from a copied git log output
alias cherry="ruby $DOTFILES_HOME/scripts/cherry-pick-sequence.rb"
# Git-Flow aliases
# https://github.com/nvie/gitflow
alias gfl='nocorrect git flow'
alias gff='nocorrect git flow feature'
alias gffs='nocorrect git flow feature start'
alias g3f='nocorrect git flow feature finish'
# iOS & OS X development
alias xco='open -a Xcode .'
alias xbo='open -a /Applications/Xcode-beta.app .'
alias aco='open -a AppCode .'
alias pii='nocorrect pod install'
alias pi='nocorrect pod install && xco'
# --repo-update is useful to avoid the occasional resolution dependency failure
# in my "day" job at Automattic
alias bpi='bundle exec pod install --repo-update'
# Ruby gem to find unused Objective-C imports, and eventually delete them
# https://github.com/dblock/fui
alias fui='nocorrect fui'
# Note! this assumes you have xctool available in your path
# and the .xctoolargs in the current working directory
alias xt='xctool test'alias ..='cd ..'
# Ruby
alias r='ruby'
alias rr='rake'
alias bi='bundle install'
alias bu='bundle update'
alias be='bundle exec'
alias br='bundle exec rake'
alias ber='bundle exec ruby'
# JavaScript & TypeScript
alias nmp='npm'
alias y='yarn'
alias yt='yarn test'
# Android
alias a='open -a Android\ Studio'
# Apps
alias chrome='open -a Google\ Chrome'
alias m='open -a MacDown'
# Markoff is a markdown previewer
# https://github.com/thoughtbot/Markoff
alias mp='open -a Markoff'
alias v='vim'
alias ao='open -a /Applications/Android\ Studio.app'
# Vim Wiki & Zettlekasen
#
# At somepoint, you might get a Ruby executable called ww, which, as far as I
# can tell, has to do with building web apps with Rack and Sinatar, and also
# seems pretty old. Seems pretty safe to override this.
# https://rubygems.org/gems/ww
# Using ww because that's the same leader command to bring up the wiki.
alias ww='vim -c VimwikiIndex'
alias tc='pushd ~/Dropbox/vimwiki && ./track_changes && popd || popd'
alias cask='brew cask'
# Utils
# (You can download the "Lee" voice from the Voice Utility app)
alias sey="say -v Oliver \"Joe, I've completed the task you gave me\""
# Carthage
# using tu because cu is already taken by a system command
alias tu='carthage update --no-build'
alias tub='carthage update --build'
# Fastlane
alias f='fastlane'
alias bf='bundle exec fastlane'
# Update any software installed via Homebrew
# fd = fresh drink
alias fd='brew update && brew upgrade'
alias pb='pbcopy'
# A cat with syntax highlighting and Git support
# https://github.com/sharkdp/bat
alias cat='bat --style="plain,header,grid"'
# GNU's wc is better than the macOS one, e.g. it has the -L option to find the
# longest line in a file
if type gwc > /dev/null; then
alias wc=gwc
fi
alias md=mkdir
mkdir_and_cd() {
mkdir $1 && cd $1
}
alias mc=mkdir_and_cd
alias haed=head
alias myip="ifconfig | grep 'inet ' | grep --invert-match 127 | cut -d' ' -f2"
# React Native
alias rn="npx react-native"
alias rni="npx react-native run-ios"
# Common typos I make
alias vm=mv
alias crul=curl
# tree
# https://osxdaily.com/2016/09/09/view-folder-tree-terminal-mac-os-tree-equivalent/
alias tree="find . -not \( -name .git -prune \) -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'"