-
Notifications
You must be signed in to change notification settings - Fork 1
/
gitconfig
89 lines (82 loc) · 3.27 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
[user]
name = Timo Tijhof
email = krinkle@fastmail.com
[core]
quotepath = false
abbrev = 10
[color]
ui = auto
[diff]
compactionHeuristic = 1
[gitreview]
remote = origin
[push]
default = current
[pull]
rebase = true
[tag]
# Make 'git tag' use semver sorting by default.
# No more 1.1.0, 1.11.0, 1.2.0, 1.20.0, etc.
# Thanks to https://andy-carter.com/blog/sort-git-tags-by-ascending-and-descending-semver
sort = v:refname
[status]
submoduleSummary = 1
[alias]
# See also https://www.mediawiki.org/wiki/Git/aliases
p = add -p
ad = add
br = branch
co = checkout
ap = commit --amend
di = diff
ds = diff --staged
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cs) %C(cyan)<%an>%Creset' --abbrev-commit --date=relative
l = ! git lg -n25
pul = pull
pulll = pull
rockon = ! git reset --hard origin/main || git reset --hard origin/master
prodon = reset --hard origin/production
sh = show
sho = show
# Given a line as "0000000 Foo Bar: Other words here" take the first two words and trim it to the
# first colon within that. This gives us all commit message components used in the repository
# (or, optionally for a directory or file only).
#
# Exclude:
# - Component longer than two space-separated words. Likely false positives from commits
# that don't use a component prefix but happen to contain a colon somewhere.
# - Double quotes. Often used in message like 'Revert "Foo: …"' or 'Re-apply "Foo: …"'.
lg-prefix = "!f() { git log --no-merges --oneline $1 | cut -d' ' -f2-3 | fgrep -v '\"' | awk -F': ' '{print $1}' | sort | uniq -c | sort -rn; }; f"
pem = ! git checkout master && git br -D
pam = ! git checkout main && git br -D
# Wildcard deletion of local branches
# usage: git wildcard-br-d 'review/*'
# usage: git wild<tab>
wildcard-br-d = "!f() { git branch -l $1 --format '%(refname:short)' | xargs git branch -D; }; f"
# Wildcard deletion of remote branches
#
# Inspired by <https://stackoverflow.com/q/3670355/319266>
#
# Note that git-push requires its branch argument to be without the
# localised "refs/remotes/origin" prefix. As such, we strip that off.
#
# $ git branch -rl 'origin/wmf/1.36*' --format '%(refname)'
# $ git branch -rl 'origin/wmf/1.36*' --format '%(refname:lstrip=3)'
# $ git push origin --delete
#
#
# usage: git remote-wildcard-br-d 'wmf/1.36*'
# usage: git remote-<tab>
remote-wildcard-br-d = "!f() { git branch -rl \"origin/$1\" --format '%(refname:lstrip=3)' | xargs git push origin --delete; }; f"
st = status -sb
bisect-up = bisect bad
bisect-down = bisect good
gerrit-config-co = "! git fetch origin refs/meta/config:refs/meta/config && git checkout meta/config"
gerrit-config-push = push origin meta/config:refs/meta/config
gerrit-config-review = push origin meta/config:refs/for/refs/meta/config
# See also https://www.mediawiki.org/wiki/Gerrit/Advanced_usage#Gerrit_project_dashboard
dashboards-checkout = "!f() { git fetch origin refs/meta/dashboards/$1:refs/meta/dashboards/$1 && git checkout -B meta/dashboards/$1 refs/meta/dashboards/$1; }; f"
dashboards-review = "!f() { git push origin HEAD:refs/for/refs/meta/dashboards/$1; }; f"
dashboards-push = "!f() { git push origin HEAD:refs/meta/dashboards/$1; }; f"
dash-co = dashboards-checkout teams
dash-review = dashboards-review teams