-
Notifications
You must be signed in to change notification settings - Fork 0
/
.zshenv
97 lines (83 loc) · 2.53 KB
/
.zshenv
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
. "$HOME/.cargo/env"
# Preferred editor for local and remote sessions
if [[ -n $SSH_CONNECTION ]]; then
export EDITOR='nvim'
else
export EDITOR='nvim'
fi
export VISUAL="$EDITOR"
#AWSume alias to source the AWSume script
alias awsume="source \$(pyenv which awsume)"
# rebase all changes from latest origin/HEAD commit onwards interactively
grchanges () {
local current_branch="$(git branch --show-current)"
local base_branch="$(git rev-parse --abbrev-ref origin/HEAD)"
local head_commit="$(git merge-base $current_branch $base_branch)"
git rebase -i $head_commit
}
# switch to default branch, clear garbage branches and pull from remote
greset() {
git switch "$(gh default-branch show --name-only)"
gbgc
git pull
}
# push git branch to github and create draft pull request
gprc() {
git push -u
gh pr create --draft --fill
}
# add all changes and commit them
gac() {
git add --all
git commit -v
}
# add all changes, commit them and push
gacp() {
gac
git push -u
}
# add all changes, create a fixup commit and push
gafp() {
git add --all
git fixup
git push -u
}
# mark github pull request as ready and add my team as assignee
gprmr() {
gh pr ready
gh pr edit --add-assignee mteufner,jkanzler,apostolosrousalis,rubeninoto
}
# mark github pull request as ready and add everyone as assignee
gprmR() {
gh pr ready
gh pr edit --add-assignee mteufner,jkanzler,SebastianFrk,StefanMensik,LiamHiscox1997,apostolosrousalis,rubeninoto
}
# garbage collect merged branches
gbgc() {
local default_branch=$(gh default-branch show --name-only)
git switch $default_branch
echo "remove merged branches"
git branch --merged $default_branch | grep -v "^[ *]*${default_branch}\$" | xargs git branch -d
echo "prune remote branches"
git remote prune origin
git pull
}
# garbage collect merged/local branches without remote
greset() {
local default_branch=$(gh default-branch show --name-only)
git switch $default_branch
echo "remove merged branches"
git branch --merged $default_branch | grep -v "^[ *]*${default_branch}\$" | xargs git branch -d
echo "prune remote branches"
git remote prune origin
echo "remove branches with 'gone' remote"
git branch -v | grep "\[gone\]" | cut -c 3- | cut -d' ' -f1 | xargs git branch -D
echo "delete local branches without remote"
git for-each-ref --format '%(refname:short) %(upstream)' refs/heads | awk '{if (!$2) print $1;}' | xargs git branch -D
git pull
}
uuid() {
uuidgen | tr '[:upper:]' '[:lower:]'
}
#Auto-Complete function for AWSume
fpath=(~/.awsume/zsh-autocomplete/ $fpath)