forked from thoughtbot/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathgitconfig
84 lines (84 loc) · 3.84 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
[init]
templatedir = ~/.git_template
[user]
name = "Xiaofeng Yuan"
email = [email protected]
#[includeIf "gitdir:~/works/sudiyi/project/"]
# path = ~/works/sudiyi/project/.gitconfig
[url "ssh://[email protected]:2222/"]
insteadOf = https://git.5th.im/
[push]
default = current
[color]
ui = auto
[alias]
ss = status
aa = !git add . && git status
au = !git add -u && git status
ap = add --patch
br = branch
ba = branch -a
ca = commit --amend -v
ci = commit -v
co = checkout
cb = checkout -b
mg = merge --no-ff
bm = rebase master
pr = !hub pull-request
dsf = "!f() { [ \"$GIT_PREFIX\" != \"\" ] && cd "$GIT_PREFIX"; git diff --color $@ | diff-so-fancy | less --tabs=4 -RFX; }; f"
up = !git fetch origin && git rebase origin/master
dup = !git fetch origin && git rebase origin/dev
rup = !git fetch origin && git rebase origin/release
cup = !git fetch origin && git rebase origin/canary
xup = !git fetch origin && git rebase origin/xadmin
publish = "!git push origin $(git current-branch)"
unpublish = "!git push origin :$(git current-branch)"
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative
co-pr = !sh -c 'git fetch origin pull/$1/head:pr/$1 && git checkout pr/$1' -
branches = for-each-ref --sort=-committerdate --format=\"%(color:blue)%(authordate:relative)\t%(color:red)%(authorname)\t%(color:white)%(color:bold)%(refname:short)\" refs/remotes
ctags = "!sh -c '[ -f .git/hooks/ctags ] || git init; .git/hooks/ctags' git-ctags"
create-branch = !sh -c 'git push origin HEAD:refs/heads/$1 && git fetch origin && git branch --track $1 origin/$1 && cd . && git checkout $1' -
current-branch = !sh -c 'git rev-parse --abbrev-ref HEAD' -
delete-branch = !sh -c 'git push origin :refs/heads/$1 && git branch -D $1' -
merge-branch = !git checkout master && git merge @{-1}
rename-branch = !sh -c 'old=$(git current-branch) && git branch -m $old $1 && git push origin --set-upstream $1 && git push origin --delete $old' -
# Unstage any files that have been added to the staging area
us = reset HEAD
# rollback the last commit
cz = reset HEAD~
# Show changes that have been staged
diffc = diff --cached
# Given a merge commit, find the span of commits that exist(ed) on that
# branch. Again, not so useful in itself, but used by other aliases.
merge-span = "!f() { echo $(git log -1 $2 --merges --pretty=format:%P | cut -d' ' -f1)$1$(git log -1 $2 --merges --pretty=format:%P | cut -d' ' -f2); }; f"
# Find the commits that were introduced by a merge
merge-log = "!git log `git merge-span .. $1`"
# Show the changes that were introduced by a merge
merge-diff = "!git diff `git merge-span ... $1`"
times = "!git log --author=\"$(git config user.name)\" --date=iso \
| perl -nalE 'if (/^Date:\\s+[\\d-]{10}\\s(\\d{2})/) { say $1+0 }' \
| sort \
| uniq -c \
| perl -MList::Util=max -nalE '$h{$F[1]} = $F[0]; }{ $m = max values %h; foreach (0..23) { $h{$_} = 0 if not exists $h{$_} } foreach (sort {$a <=> $b } keys %h) { say sprintf \"%02d - %4d %s\", $_, $h{$_}, \"*\"x ($h{$_} / $m * 50); }'"
mmr = "!git push origin HEAD -o merge_request.create -o merge_request.target=master -o merge_request.merge_when_pipeline_succeeds -o merge_request.label=\"canary\" -o merge_request.title=\"$(git branch --show-current)\""
rmr = "!git push origin HEAD -o merge_request.create -o merge_request.target=release -o merge_request.merge_when_pipeline_succeeds -o merge_request.title=\"$(date \"+CI-%y%m%d\")\""
[core]
excludesfile = /Users/xfyuan/.gitignore
autocrlf = input
ignorecase = false
quotepath = false
[merge]
ff = only
tool = vimdiff
[diff]
tool = vimdiff
[difftool]
prompt = false
[commit]
template = ~/.gitmessage
[fetch]
prune = true
[include]
path = ~/.gitconfig.local
[credential]
helper = osxkeychain