-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.zsh_aliases
171 lines (140 loc) · 4.8 KB
/
.zsh_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
#!/bin/zsh
#. /Library/Developer/CommandLineTools/usr/share/git-core/git-completion.zsh
__define_git_completion () {
eval "
_git_$2_shortcut () {
COMP_LINE=\"git $2\${COMP_LINE#$1}\"
let COMP_POINT+=$((4+${#2}-${#1}))
COMP_WORDS=(git $2 \"\${COMP_WORDS[@]:1}\")
let COMP_CWORD+=1
local cur words cword prev
_get_comp_words_by_ref -n =: cur words cword prev
_git_$2
}
"
}
__gitshortcut () {
type _git_$2_shortcut &>/dev/null || __define_git_completion $1 $2
alias $1="git $2 $3"
complete -o default -o nospace -F _git_$2_shortcut $1
}
# GIT
alias gda="git branch | grep -v "master" | xargs git branch -d"
alias gDa="git branch | grep -v "master" | xargs git branch -D"
#alias gp="git push"
__gitshortcut gp push
__gitshortcut gpu push -u
alias gpo="git push origin"
alias gpom="git push origin master"
alias gpod="git push origin devel"
#alias gl="git pull"
__gitshortcut gl pull
alias glo="git pull origin"
alias glom="git pull origin master"
alias glod="git pull origin devel"
#alias glr="git pull --rebase"
__gitshortcut glr pull --rebase
#alias glro="git pull --rebase origin"
__gitshortcut glro pull '--rebase origin'
#alias glrom="git pull --rebase origin master"
__gitshortcut glrom pull '--rebase origin master'
#alias glrod="git pull --rebase origin devel"
__gitshortcut glrod pull '--rebase origin devel'
#alias gc="git commit"
__gitshortcut gc commit
#alias gca='git commit -a'
__gitshortcut gca commit -a
#alias gco="git checkout"
__gitshortcut gco checkout
alias gcom="git checkout master"
alias gcod="git checkout devel"
alias gapf="git commit --amend --no-edit -n && git push -f"
#alias gb="git branch"
__gitshortcut gb branch
#alias gm="git merge"
__gitshortcut gm merge
#alias gs="git status"
__gitshortcut gs status
#alias gd="git diff"
__gitshortcut gd diff
#alias ga="git add"
__gitshortcut ga add
#alias gf="git fetch"
__gitshortcut gf fetch
alias gfp="git fetch --prune"
#alias gr='git reset'
__gitshortcut gr reset
#alias gst="git stash"
__gitshortcut gst stash
alias gstp="git stash pop"
alias gmm="git merge master"
alias gmd="git merge devel"
alias grs="git reset --soft"
alias grh="git reset --hard"
alias ghfs="git hub-feature start"
alias ghfu="git hub-feature update"
alias ghfp="git hub-feature publish"
alias ghfr="git hub-feature review"
alias ghff="git hub-feature finish"
alias gstrp="echo '======= Stashing... =======' && gst && echo '======= PULL Rebasing... =======' && glr && echo '======= Stash Popping... =======' && gstp"
alias gcop="gco pm-develop"
alias gmp="gm pm-develop"
#alias hpr="hub pull-request -a emoreth"
alias ppr="gp && hpr && pr"
# Check if main exists and use instead of master
function git_main_branch() {
command git rev-parse --git-dir &>/dev/null || return
local branch
for branch in main trunk; do
if command git show-ref -q --verify refs/heads/$branch; then
echo $branch
return
fi
done
echo master
}
alias gfp="git fetch --prune"
alias gs="git status"
alias gda='git branch --format="%(refname:short)" | grep -v $(git_main_branch) | xargs git branch -d'
alias gDa='git branch --format="%(refname:short)" | grep -v $(git_main_branch) | xargs git branch -D'
alias gcom="git checkout $(git_main_branch)"
alias gpr="gh pr create --fill"
alias glr="git pull --rebase"
alias gstrp="gsta && gup && gstp"
alias gapf="git commit --amend --no-edit -n && git push -f"
# Circle CI
function ci() {
open https://circleci.com/gh/carta/workflows/$(basename `git rev-parse --show-toplevel`)/tree/$(echo $(git rev-parse --abbrev-ref HEAD) | sed 's/\//%2F/g')
}
function pr() {
open $(hub pr list -h "$(git rev-parse --abbrev-ref HEAD)" -f "%i %t -> %U%n" | grep -E "http.+" -o)
}
# Kubernetes
alias k="kubectl"
alias kg="kubectl get"
alias kx="kubectx"
alias ks="kubens"
alias kgp="k get pods"
alias kgpw="k get pods --output=wide"
alias kgpy="k get pods -o yaml"
alias kgs="k get services"
alias kgsy="k get services -o yaml"
alias kgd="k get deployments"
alias kgdy="k get deployments -o yaml"
alias kgn="k get namespaces"
alias kgj="k get jobs"
alias kgcj="k get cronjobs"
alias kge="k get events --sort-by=.metadata.creationTimestamp "
alias kdp="k delete pod --wait=0 "
# Already on the new docker aliases
# alias dps="docker ps"
alias dka='docker kill $(docker ps -q)'
alias dcb="docker compose build"
alias taap="terraform apply -parallelism=30 -auto-approve"
alias tp="terraform plan -parallelism=30"
alias unlock="xattr -dr com.apple.quarantine "
alias grpcurl="docker run fullstorydev/grpcurl"
alias dummypod='kubectl run -i --tty --rm debug --image=debian --restart=Never -- bash'
complete -C '/opt/homebrew/bin/aws_completer' aws
export AWS_DEFAULT_OUTPUT=json
export AWS_PAGER=