-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfn-git.sh
78 lines (68 loc) · 1.78 KB
/
fn-git.sh
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
# note: this require some aliases defined on the git-setup.sh file
export GIT_PILE_PREFIX="luan."
export GIT_PILE_USE_PR_TEMPLATE=true
# new git pile aliases
alias u='git fetch origin main && git rebase origin/main'
alias spr='git submitpr'
alias upr='git updatepr'
alias gcm='git commit -m '
alias gcma='git commit -m "Address comments"'
alias gac='gall && gcma && git push'
alias grc='git rebase --continue'
alias grs='git rebase --skip'
alias gra='git rebase --abort'
alias gcb='git co -b'
alias gca='git commit --amend --no-edit'
alias ga='git add'
alias gall='git add -A'
alias gpr='git pull --rebase'
alias gpf='git pushf' # pushf is aliased to force with lease
alias gg='git co green && gpr'
alias gm='git co main && gpr'
alias grg='git rebase green'
alias grm='git rebase main'
alias gsf='git stash push '
alias s='git status'
alias d='git diff -w'
alias xxx="gall && gcm '.' && git push"
alias branch='git rev-parse --abbrev-ref HEAD'
function gpu() {
b=`branch`
git pull --rebase origin "$b"
}
alias gitb='git --no-pager branch --sort=-committerdate'
function gb() {
gbb 15 $1
}
function gbb() {
param=$2
n=$1
if [ -z "$param" ]; then
result=`gitb | head -n$n | awk '{ print "(" NR ") " $0 }'`
echo "$result"
else
branch=`gitb | awk "NR==$param" | sed 's/[ *]*//g'`
git checkout "$branch"
fi
}
# graphite
function og_gt() {
command gt "$@"
}
function gt() {
if [[ "$1" == "s" ]]; then
echo "USE gs or gsd my dude"
return 2
elif [[ "$1" == "ms" ]]; then
shift
command gt s "$@"
else
command gt "$@"
fi
}
alias gtt='gt co `gt trunk`'
alias gts='gtt && gt sync'
alias gms='gall && gt modify && gt s'
alias gmss='gall && gt modify && gt ss'
alias gs='og_gt s -p --cli --no-edit'
alias gsd='gs && gh pr edit --add-label "do-not-request-reviewers"'