-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgitconfig
89 lines (78 loc) · 2.51 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
85
86
87
88
89
[color]
branch = auto
diff = auto
status = auto
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow bold
frag = magenta bold
old = red bold
new = green bold
[color "status"]
added = yellow
changed = green
untracked = cyan
[alias]
g = git
cm = shortlog -nse --no-merges
fi = !git ls-files | grep -i
gr = grep -Ii
# log (hash, relative date, commit, commiter)
ld = log --pretty=format:'%C(yellow)%h %C(bold red)%ad%C(reset)%C(red)%d %C(reset)%s%C(blue) [%cn]' --decorate --date=relative
# log git history tree graph
lg = log --graph --decorate
# log edited files per commit
lf = log --pretty=format:'%C(yellow)%h%C(red)%d %C(reset)%s%C(blue) [%cn]' --decorate --numstat
ph = push origin
pl = pull origin
s = status -vsb
# if no arguments clear the stash
# or drop multiple stashes passing the numbers
# usage: git shd 2 5 6 9
shd = "!f() { !(($#)) && git stash clear || for ((i=1;i<=$#;i++)); do n=$((${!i}+1-$i)); git stash drop stash@{$n} & done; wait; }; f"
# show specified stash changes
# usage: git shs 3
shs = !sh -c 'git stash show -p stash@{$0}'
gh = !git init && git add . && git commit -am 'add(*): initial commit' && git remote add origin [email protected]:julien/$(basename $PWD).git && git push -u origin master
# show un merged
sm = diff --name-status --diff-filter=U
unstage = reset --
# Delete all the local merged branches
cleanup = "!git branch --merged | grep -v '\\*\\|master\\|main\\|develop\\|dev' | xargs -n 1 -r git branch -d"
# fetch and rebase
# if not arguments passed, the command executed will be git fetch origin <current-branch>
# usage:
# git get
# or
# git get someOrigin someBranch
get = "!f() { o=origin && (($#)) && o=$1; b=$(git rev-parse --abbrev-ref HEAD) && (($#>1)) && b=$2; (git fetch $o $b && git rebase $o/$b) }; f"
[merge]
tool = opendiff
[diff]
tool = opendiff
[difftool]
prompt = false
[user]
name = zwergius
email = [email protected]
# These values are set in ~/.local.gitconfig
[difftool "diffmerge"]
cmd = diffmerge \"$LOCAL\" \"$REMOTE\"
[mergetool "diffmerge"]
cmd = "opendiff --merge --result=\"$MERGED\" \"$LOCAL\" \"$(if test -f \"$BASE\"; then echo \"$BASE\"; else echo \"$LOCAL\"; fi)\" \"$REMOTE\""
trustExitCode = true
[push]
default = simple
autoSetupRemote = true
[core]
excludesfile = ~/.gitignore
pager = diff-so-fancy | less --tabs=4 -RFX
[include]
path = ~/.local.gitconfig
[pull]
ff = only
[fetch]
prune = true