-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgit-aliases.plugin.zsh
73 lines (58 loc) · 1.47 KB
/
git-aliases.plugin.zsh
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
pull_or_push() {
if [ $# -eq 2 ]; then
git $1 $2 `git rev-parse --abbrev-ref HEAD`
else
git $1 origin `git rev-parse --abbrev-ref HEAD`
fi
}
pull() { pull_or_push "pull" $@ }
push() { pull_or_push "push" $@ }
alias gf='git fetch'
alias gpo="git push origin"
alias gpom="git push origin master"
alias glo="git pull origin"
alias glom="git pull origin master"
alias gb='git branch'
alias grh='git reset --hard'
alias glog="git log --oneline --decorate"
status() {
if [ "$GIT_ALIASES_SHORTER_GIT_STATUS" -ne 1 ]; then; git status
else; git status -sb; fi
}
alias gs='status'
co() {
git fetch
git checkout "$1"
if [ "$GIT_ALIASES_SILENCE_GIT_STATUS" -ne 1 ]; then; git status; fi
}
compdef _git co=git-checkout
cob() {
git checkout -b "$1"
if [ "$GIT_ALIASES_AUTOPUSH_NEW_BRANCH" -eq 1 ]; then
git add "$(git rev-parse --show-toplevel)" && git commit -a -m "Started $1" && push
fi
}
cobm() {
git checkout master && pull && git checkout -b "$1"
}
corbm() {
corp master && git checkout -b "$1"
}
cop() {
git fetch && git checkout "$1" && pull && git fetch
if [ "$GIT_ALIASES_SILENCE_GIT_STATUS" -ne 1 ]; then; git status; fi
}
compdef _git cop=git-checkout
corp() {
co "$1" && rp
}
compdef _git corp=git-checkout
gd() {
if [ "$GIT_ALIASES_ICDIFF" -eq 1 ]; then; git icdiff
elif [ "$GIT_ALIASES_ICDIFF" -eq 2 ]; then; git difftool --extcmd icdiff
else; git diff; fi
git status
}
prune() {
git branch -D "$1" && git push origin --delete "$1"
}