-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitconfig
103 lines (99 loc) · 5.11 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
[user]
name = Peter Thorin
email = pthorin@volvocars.com
editor = vim
[alias]
praise = blame
ls = log --graph --decorate --format=short --all
lminimal = log --graph --decorate --pretty=oneline --all
lm = lminimal
lsg = log --graph --decorate --all
lsf = log --graph --decorate --all --format=full
lsp = log --graph --decorate --format=short --all -p
last = log -1
lastfiles=diff-tree --no-commit-id --name-only HEAD -r
openlastfiles=!git diff-tree --no-commit-id --name-only HEAD -r | xargs vim -o
lasts = log -1 --stat
lastp = log -1 -p
lastsp = log -1 -p --stat
lastps = log -1 -p --stat
st = status --short --branch
co = checkout
cod = "!f() { DEFAULT=$(git default) ; git co $DEFAULT; git fetch --prune ; git rebase ; }; f"
ec = config --global -e
up = "!f() { git fetch --prune $@ ; git rebase ; }; f"
upa = "!f() { git fetch --prune ; git rebase --autostash $@; }; f"
; upd = "!git pull --rebase --prune origin $(git default)"
upd = "!f() { DEFAULT=$(git default) ; git fetch --prune ; git rebase origin/$DEFAULT; }; f"
cob = checkout -b
save = !git add -A && git commit -m 'SAVEPOINT'
wip = commit -am "WIP"
undo = reset HEAD~1 --mixed
amend = commit -a --amend
can = commit -a --amend --no-edit
wipe = !git add -A && git commit -qm 'WIPE SAVEPOINT' && git reset HEAD~1 --hard
pushf = push origin --force-with-lease
#default = "!git remote show origin|grep --only-matching -E 'HEAD branch: .+?$' " ; |sed -n '{ s@HEAD branch: \(\.+\)$@\1@p }'"
#defaultx = "!git remote show origin|grep --only-matching -E 'HEAD branch: .+?$' |sed -n 's/HEAD branch: //p '"
default = "!git remote show origin|awk '/HEAD branch: /{print $NF}'"
# parpar = "!f() { git show-branch | sed 's/].*//' | grep '\*' | grep -v '$(git rev-parse --abbrev-ref HEAD)' | head -n1 | sed 's/^.*\[//' | sed 's/\^//'}; f"
bclean = "!f() { DEFAULT=$(git default) ; git checkout ${1-$DEFAULT} && git branch --merged ${1-$DEFAULT} | grep -v " ${1-$DEFAULT}$" | xargs git branch -d; }; f"
bdone = "!f() { DEFAULT=$(git default) ; git checkout ${1-$DEFAULT} && git up && git bclean ${1-$DEFAULT}; }; f"
# squashdone = "!f() { DEFAULT=$(git default) ; git checkout -q ${1-$DEFAULT} && git for-each-ref refs/heads/ "--format=%(refname:short)" | while read branch; do mergeBase=$(git merge-base ${1-$DEFAULT} $branch) && [[ $(git cherry ${1-$DEFAULT} $(git commit-tree $(git rev-parse "$branch^{tree}") -p $mergeBase -m _)) == "-"* ]] && echo "$branch is merged into master and can be deleted"; done; }; f"
# rebdone = "!f() { git checkout master && git up && git checkout $1 && git rebase master && if [ $(git need-rebase) -eq 1 ]; then git rebase master ; fi && git bdone }; f"
clean-branches ="!f() { git checkout main && git up && git branch --list |grep -v " main$" | xargs git branch -d; }; f"
clean-master-branches ="!f() { git checkout master && git up && git branch --list |grep -v " master$" | xargs git branch -d; }; f"
list = branch --list
list-merged = branch --merged
need-rebase = "!f() { current=$(git rev-parse --abbrev-ref HEAD); hash1=$(git show-ref --heads -s main); hash2=$(git merge-base ${current} main); PAGER='' git diff --shortstat ${hash1} ${hash2}; test "${hash1}" = "${hash2}" && echo "Nah, we good." && exit 0 || echo "Rebase is required"; exit 1; }; f"
copy-hash = "!git log -n1 --format='%H' |xclip -in -selection clipboard"
changes-to-master = "diff --name-only master"
prco = "!hub pr checkout"
prlist = "!hub pr list --color=always"
prl = "pr list --color=always"
dry = "!f() { git merge-tree $(git merge-base $2 $1) $2 $1; }; f"
dryconflict = "dryconflict"
documentation = "!f() { git show $(git blame $1 -L $2,$2 |awk '{print $1}') }; f"
renametomain = "!f() { git fetch --all ; git remote set-head origin -a ; git branch --set-upstream-to origin/main ; git branch -m master main ; }; f"
delete-squashed = "!git-delete-squashed"
files = !git diff --name-only $(git merge-base HEAD $REVIEW_BASE)
# Open all files changed since REVIEW_BASE in Vim tabs
# Then, run fugitive's :Gdiff in each tab, and finally
# tell vim-gitgutter to show +/- for changes since REVIEW_BASE
review = !vim -p $(git files) +\"tabdo Gdiff $REVIEW_BASE\" +\"let g:gitgutter_diff_base = '$REVIEW_BASE'\"
# Same as the above, except specify names of files as arguments,
# instead of opening all files:
# git reviewone foo.js bar.js
reviewone = !vim -p +\"tabdo Gdiff $REVIEW_BASE\" +\"let g:gitgutter_diff_base = '$REVIEW_BASE'\"
[push]
default = current
[pull]
rebase = true
; [url "git@github.com:"]
; insteadOf = https://github.com/
[hooks "confirm"]
match = TODO
match = HACK
match = FIXME
match = ^//
[commit]
verbose = true
[init]
defaultBranch = main
[core]
autocrlf = input
excludesFile = ~/.gitignore
pager = batcat
symlinks = false
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true
[credential]
credentialStore = secretservice
helper = /usr/local/bin/git-credential-manager
[credential "https://dev.azure.com"]
useHttpPath = true
[credential "https://prod-global-open-innovation-portal-apim.scm.azure-api.net"]
provider = generic