-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgit
95 lines (92 loc) · 2.18 KB
/
git
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
#!/bin/bash
alias g='git'
__git_complete g __git_main
alias gut='git'
__git_complete gut __git_main
alias gs='git status -sb'
__git_complete gs _git_status
alias gsm='gs | egrep "^.M"'
alias gc='git commit -v'
__git_complete gc _git_commit
alias gca='gc -a'
__git_complete gca _git_commit
alias gcm='gca -m'
__git_complete gcm _git_commit
alias gco='git checkout'
__git_complete gco _git_checkout
alias ga='git add'
__git_complete ga _git_add
alias gwack='git reset --hard HEAD~1'
function gd {
git --no-pager diff --color $@ | diff-so-fancy | less --tabs=4 -E -j-1 -RFX
}
__git_complete gd _git_diff
alias gds='gd --staged'
__git_complete gds _git_diff
alias gdw='gd --ignore-space-change --ignore-space-at-eol'
__git_complete gdw _git_diff
alias gdp='git diff'
__git_complete gdp _git_diff
alias gb='git branch'
__git_complete gb _git_branch
alias gf='git fetch'
__git_complete gf _git_fetch
alias gfa='gf --all'
alias gfo='gf origin'
alias gpo='g push origin'
__git_complete gpo _git_push
alias gp='git push'
__git_complete gp _git_push
alias gdev='gpo dev'
alias gl="git log --all --graph --pretty=format:'%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative"
function gcat {
git cat-file -t $1 && git cat-file -p $@
}
# git checkout pull request
# gcopr upstream 22
function gcopr {
git fetch $1 pull/$2/head:pr-$2 --force
git checkout pr-$2
}
# show files in a commit
function gsf {
git diff-tree --no-commit-id --name-only -r $@
}
# show commit content
function gsc {
gd $1^1 $1 "${@:2}"
}
function gt {
v=$1
git tag -a $1 -m "Version ${v}" $2 $3
echo "Version ${v} created"
}
# checkout remote gcor origin branch
function gcor {
gco -b $2 $1/$2
}
# gpt upstream
function gpt {
git push $1 --tags
}
# create release signed commit and signed annotated tag
function grel {
v=$1
gcm "(release) Version ${v}" -S
gt $1 -s
}
# removes a file from the staging area and check it out
function greco {
g reset -- $1;
gco $1;
echo "Checked out" $1
}
# push to both origin and upstream
function gpa {
g push upstream $@;
g push origin $@;
}
# print some infos
git config --global user.name
git config --global user.email
git config --global user.signingkey