-
Notifications
You must be signed in to change notification settings - Fork 2
/
.gitconfig
60 lines (56 loc) · 1.62 KB
/
.gitconfig
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
[user]
name = Bruce Chen
email = bruce30262@pm.me
[core]
excludesfile = ~/dotfiles/.gitignore_global
editor= 'vim'
[github]
user = bruce30262
email = bruce30262@pm.me
[alias]
a = add
aa = add -A
ai = add -i
###############
d = diff
###############
b = branch
ba = branch -a
###############
cm = commit
cma = commit --amend
###############
co = checkout
###############
f = fetch
fu = fetch upstream
###############
m = merge
###############
ps = push
psa = push --all
psf = push --force
###############
pl = pull
###############
r = remote
rv = remote -v
###############
rs = reset
rss = reset --soft
rsh = reset --hard
###############
s = status
su = status -u
###############
rb = rebase
rbi = rebase -i
###############
re = restore
res = restore --staged
# change a git repo's remote url from https to ssh (for github only)
# have to use 2 back slash because the first back slash will read by .gitconfig
github-h2s = "!new_url=$(git rv | awk '{print $2}' | head -1 | sed 's/https:\\/\\/github.com\\//git@github.com:/g') && git remote set-url origin $new_url && echo 'git remote -v:' && git rv"
# change a git repo's remote url from ssh to https (for github only)
# have to use 2 back slash because the first back slash will read by .gitconfig
github-s2h = "!new_url=$(git rv | awk '{print $2}' | head -1 | sed 's/git@github.com:/https:\\/\\/github.com\\//g') && git remote set-url origin $new_url && echo 'git remote -v:' && git rv"