-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitconfig
112 lines (89 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
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
[user]
name = Timm Heuss
email = [email protected]
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
required = true
process = git-lfs filter-process
[core]
pager = delta
excludesfile = ~/.git-global-ignore
[interactive]
diffFilter = delta --color-only
change-commits = "!f() { VAR=$1; OLD=$2; NEW=$3; shift 3; git filter-branch --env-filter \"if [[ \\\"$`echo $VAR`\\\" = '$OLD' ]]; then export $VAR='$NEW'; fi\" $@; }; f "
[difftool "sourcetree"]
cmd = open -W -a Meld --args \"$LOCAL\" \"$PWD/$REMOTE\"
path =
[mergetool "sourcetree"]
cmd = open -W -a Meld --args --auto-merge \"$PWD/$LOCAL\" \"$PWD/$BASE\" \"$PWD/$REMOTE\" --output=\"$PWD/$MERGED\"
trustExitCode = true
# Further config no longer needed or even causing conflicts, e.g. https://stackoverflow.com//questions/35642530/git-difftool-not-opening-sometimes#answer-41971435
[diff]
tool = kdiff3
trustExitCode = true
guitool = kdiff3
[merge]
tool = kdiff3
conflictStyle = zdiff3
[alias]
ac = !git add -u && git commit -m
cosh = !git commit && git push
head = log -1
co = checkout
s = status
hist = log --pretty=format:\"%h %ad | %s%d [%an]\" --graph --date=short
whatsnew = diff --stat --cached
ref-ignore = !sh -c 'curl https://raw.githubusercontent.com/github/gitignore/master/'$1'.gitignore >> .gitignore'
# https://davidwalsh.name/more-awesome-git-aliases
branches = "!$HOME/.scripts/git-branches"
my-branches = "!git branches | grep \"$(git config user.name)\""
aliases = "config --get-regexp alias"
mru = for-each-ref --sort=-committerdate --count=10 refs/heads/ --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(color:red)%(objectname:short)%(color:reset) - %(contents:subject) - %(authorname) (%(color:green)%(committerdate:relative)%(color:reset))'
whatadded = log --diff-filter=A
amend = commit --all --amend --no-edit
# Override commit date, accepts various forms:
# git commit-predate "2020-10-10"
# git commit-predate "2020-10-10T10:10:10"
commit-predate= "!f() { REFDATE=$1; shift; GIT_COMMITTER_DATE=\"$REFDATE\" git commit --date=\"$REFDATE\" $*; }; f"
# State a reference file to take last-modified date from
commit-refdate= "!f() { REFDATE=$(stat -f \"%Sm\" -t \"%Y-%m-%dT%H:%M:%S\" \"$1\"); shift; git commit-predate \"$REFDATE\" $*; }; f"
time-machine = "!gitk"
tm = "time-machine"
# https://devconnected.com/how-to-clean-up-git-branches/
housekeeping = "!git branch -r --merged | egrep -v \"(^\\*|master|main|dev)\" | xargs -n 1 git push --delete origin"
f = fuzzy
sync = "!git pull && git push"
#vim = "!git ls-files | fzf --preview \"bat --style=numbers --color=always --line-range :500 {}\" | xargs -o vim; git status"
vim = "!vim -c \"GFiles\""
v = vim
i = "!lazygit"
vimi = "!git vim && git i"
defrag = "!git reflog expire --all --expire=now; git gc --prune=now --aggressive; git rm --cached -r .; git reset --hard"
# https://stackoverflow.com/questions/12809951/git-cannot-undo-modified-files#12815013
renormalize = "!git rm --cached -r .; git reset --hard"
# https://stackoverflow.com//questions/7124914/how-to-search-a-git-repository-by-commit-message#answer-7125014
find = log --pretty=\"format:%Cgreen%H %Cblue%s\" --name-status --grep
mirror-to-bitbucket = "!$HOME/.git-scripts/mirror-to-bitbucket"
# https://stackoverflow.com/questions/6127328/how-do-i-delete-all-git-branches-which-have-been-merged
delete-merged = "!git branch --merged | grep -Ev \"(^\\*|master|main|dev)\" | xargs git branch -d"
graph = "log --graph --decorate --oneline --all"
[include]
path = ~/.git-over-ssh-enabled
[help]
autocorrect = 10
[pull]
rebase = true
[delta]
features = side-by-side line-numbers
[commit]
verbose = true
[init]
defaultBranch = main
[branch]
# https://stevenharman.net/git-pull-with-automatic-rebase
autosetuprebase = always
[rebase]
autoStash = true
[push]
autoSetupRemote = true