-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.gitconfig
131 lines (96 loc) · 4.66 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
[user]
name = Joe Gornick
email = [email protected]
[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
[color]
ui = true
[core]
eol = lf
autocrlf = false
safecrlf = false
whitespace = space-before-tab,-indent-with-non-tab,trailing-space
excludesfile = ~/.gitignore
[alias]
st = status
br = branch
co = checkout
cp = cherry-pick
rb = rebase
track = ~/bin/git-track
rollup = ~/bin/git-rollup
# List aliases
ar = ! git add -u && git rebuild
aliases = ! git config --get-regexp ^alias\\. | sed -e s/^alias\\.// -e s/\\ /\\ =\\ /
# Amend changes to a any commit
# https://stackoverflow.com/questions/1186535/how-to-modify-a-specified-commit/48999882#48999882
amend-to = "!f() { SHA=`git rev-parse \"$1\"`; git commit --fixup \"$SHA\" && GIT_SEQUENCE_EDITOR=true git rebase --interactive --autosquash \"$SHA^\"; }; f"
branches = for-each-ref --sort=-committerdate --format=\"%(color:blue)%(authordate:relative)\t%(color:red)%(authorname)\t%(color:white)%(color:bold)%(refname:short)\" refs/remotes
# List contributors with number of commits
# See`git help shortlog`
contributors = shortlog --summary --numbered
current-branch = rev-parse --abbrev-ref HEAD
delete-gone-branches = "!git show-gone-branches | xargs git branch -D"
delete-remote-merged-branches = "!git show-remote-merged-branches | xargs -n 1 git push origin --delete"
# Find branches containing commit
fb = "!f() { git branch -a --contains $1; }; f"
# Find commits by source code
fc = "!f() { git log --pretty=format:'%C(yellow)%h %Cblue%ad %Creset%s%Cgreen [%cn] %Cred%d' --decorate --date=short -S$1; }; f"
# Find commits by commit message
fm = "!f() { git log --pretty=format:'%C(yellow)%h %Cblue%ad %Creset%s%Cgreen [%cn] %Cred%d' --decorate --date=short --grep=$1; }; f"
# Find tags containing commit
ft = "!f() { git describe --always --contains $1; }; f"
# Switch to a branch, creating it if necessary
# Same as chb - left for BC.
go = "!f() { git checkout -b \"$1\" 2> /dev/null || git checkout \"$1\"; }; f"
# log
l = log --graph --decorate --date=short
changes = log --pretty=format:\"%h %cr %cn %Cgreen%s%Creset\" --name-status
short = log --pretty=format:\"%h %cr %cn %Cgreen%s%Creset\"
simple = log --pretty=format:\" * %s\"
shortnocolor = log --pretty=format:\"%h %cr %cn %s\"
overview = log --all --oneline --no-merges
changelog = "!sh -c \"git log --oneline --no-merges $1..HEAD\" -"
filelog = log -u # show changes to a file
my-changes = "!r() { git short $1..HEAD | grep --color=never \"${2:-$(git config user.name)}\"; }; r"
# Pretty log of commits. Supports options of git log
# https://www.kernel.org/pub/software/scm/git/docs/git-log.html#_pretty_formats
log-pretty = log --graph --decorate --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an - %aE>%Creset' --abbrev-commit
prune-remote = "!r() { git remote prune "${1:-origin}"; }; r"
rebase-remote = "!r() { git rebase "${1:-origin}/$(git current-branch)"; }; r"
rebuild = "!r() { git commit --amend --no-edit --allow-empty; git push "${1:-origin}" --force-with-lease --no-verify; }; r"
#via http://stackoverflow.com/questions/5188320/how-can-i-get-a-list-of-git-branches-ordered-by-most-recent-commit
recent-branches = "!git for-each-ref --count=20 --sort=-committerdate refs/heads/ --format='%(refname:short)'"
# Show verbose output about remotes
remotes = remote -v
reset-to-remote = "!r() { git reset --hard "${1:-origin}/$(git current-branch)"; }; r"
# Remove the old tag with this name and tag the latest commit with it.
retag = "!r() { git tag -d $1 && git push origin :refs/tags/$1 && git tag $1; }; r"
# find a string in the entire git history
search-git-history = "!r() { git rev-list --all | xargs git grep -F $1; }; r"
show-gone-branches = "!git branch -vv | awk '/origin\\/.*: gone]/{print$1}'"
show-remote-merged-branches = "!git branch --no-color -r --merged master | sed 's/origin\\///' | grep -v '\\*' | grep -v master | grep -v develop"
find-merge = "!sh -c 'commit=$0 && branch=${1:-HEAD} && (git rev-list $commit..$branch --ancestry-path | cat -n; git rev-list $commit..$branch --first-parent | cat -n) | sort -k2 -s | uniq -f1 -d | sort -n | tail -1 | cut -f2'"
show-merge = "!sh -c 'merge=$(git find-merge $0 $1) && [ -n \"$merge\" ] && git show $merge'"
[push]
default = current
followTags = true
[merge]
renamelimit = 4093
[init]
defaultBranch = main