-
Notifications
You must be signed in to change notification settings - Fork 0
/
zshrc
executable file
·67 lines (52 loc) · 1.15 KB
/
zshrc
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
#!/usr/bin/env bash
getGitDefaultBranch() (
(git remote show origin || true) | sed -n '/HEAD branch/s/.*: //p'
)
branchAndOpenPR() (
git checkout -b "${1}"
git add .
git commit -S -m "${2}"
git push origin "${1}"
gh pr create --web
)
checkoutDefaultBranch() (
local defaultBranch
defaultBranch=$(getGitDefaultBranch)
git checkout "${defaultBranch}"
)
checkoutRemoteBranch() (
local defaultBranch
defaultBranch=$(getGitDefaultBranch)
checkoutDefaultBranch
git pull
git checkout -b "${1}" "origin/${1}"
)
addCommitPush() (
git add .
git commit -S -m "$1"
local branchName
branchName="$(git rev-parse --abbrev-ref HEAD)"
git push origin "${branchName}"
)
updateMainAndRebaseLastBranch() (
local defaultBranch
defaultBranch=$(getGitDefaultBranch)
git checkout "${defaultBranch}"
git pull origin "${defaultBranch}"
git checkout -
git rebase "${defaultBranch}"
)
cloneWSRepository() (
if [[ ! -d ~/code/ws ]]; then
mkdir ~/code/ws
fi
pushd ~/code/ws || exit
gh repo clone "git@github.com:wealthsimple/${1}.git"
popd || exit
)
stashPullPop() (
git stash
checkoutDefaultBranch
git pull
git stash pop
)