-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.gitconfig
93 lines (84 loc) · 3.7 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
[credential]
helper = cache --timeout=86400
[alias]
# List out of all of the active aliases
aliases = !git config --list | grep 'alias\\.' | sed 's/alias\\.\\([^=]*\\)=\\(.*\\)/\\1\\=> \\2/' | sort
# Ignore multiple repeated git commands
git = !exec git
# An abbreviated listing of commits
lg = log --color --graph --abbrev-commit --pretty=format:'%C(red)%h%Creset -%C(yellow)%d%Creset %s %C(green)(%ar) %C(bold blue)<%an>%Creset%C(cyan)% GK%Creset'
# An abbreviated listing of commits focusing on commit date/time
history = log --color --graph --abbrev-commit --date=short --pretty=format:'%C(red)%h%Creset %C(green)%ad%Creset -%C(yellow)%d%Creset %s %C(bold blue)<%an>%Creset %C(green)(%cr)%Creset'
# List out all of the branches and their last update
branches = for-each-ref --sort=-committerdate refs/heads/ --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(color:red)%(objectname:short)%(color:reset) - %(authorname) (%(color:green)%(committerdate:relative)%(color:reset))'
# List out the commits that will be pushed
to-push = log --branches --not --remotes --color --graph --abbrev-commit --pretty=format:'%C(red)%h%Creset -%C(yellow)%d%Creset %s %C(green)(%cr) %C(bold blue)<%an>%Creset'
# List all tags - make cli consistent
tags = tag
# List current stashes - make cli consistent
stashes = stash list
# Remove a staged file(s)
unstage = reset -q HEAD --
# Revert file(s)
discard = checkout --
# Revert last commit
uncommit = reset --mixed HEAD~
# Amend staged files to last commit
amend = commit --amend
# Stage deleted files
stage-del = rm $(git ls-files --deleted -z)
# Undo the last commit
undo = reset --hard HEAD~1
# Ammend an older commit
fixup = "!f() { TARGET=$(git rev-parse "$1"); git commit --fixup=$TARGET ${@:2} && EDITOR=true git rebase -i --autostash --autosquash $TARGET^; }; f"
# Use the difftool to diff an entire directory
ddt = difftool --dir-diff --no-symlinks
# shorten checkout
co = checkout
# list your most recently used branches - https://ses4j.github.io/2020/04/01/git-alias-recent-branches/
lb = !git reflog show --pretty=format:'%gs ~ %gd' --date=relative | grep 'checkout:' | grep -oE '[^ ]+ ~ .*' | awk -F~ '!seen[$1]++' | head -n 10 | awk -F' ~ HEAD@{' '{printf(\" \\033[33m%s: \\033[37m %s\\033[0m\\n\", substr($2, 1, length($2)-1), $1)}'
# sign old commits since hash/tag - https://superuser.com/questions/397149/can-you-gpg-sign-old-commits#comment1794611_1123928
resign = "!re() { git rebase --exec 'git commit --amend --no-edit -n -S' -i $1; }; re"
# remove deleted upstream branches from local repo
gone = "!gn() { git fetch --all --prune; git branch -vv | awk '/: gone]/{print $1}' | xargs -r git branch -D }; f"
# yolo
yolo = '!git add -A && git commit -m "$(curl -s whatthecommit.com/index.txt)"'
[core]
excludesfile = ~/.gitignore_global
editor = vim
[init]
defaultBranch = main
[push]
default = simple
followTags = true
[diff]
tool = vimdiff
guitool = bcompare
[difftool]
prompt = false
[merge]
tool = vimdiff
guitool = bcompare
[mergetool]
prompt = true
[difftool "vimdiff"]
trustExitCode = true
cmd = vimdiff "$LOCAL" "$REMOTE"
[mergetool "vimdiff"]
trustExitCode = true
cmd = vimdiff "$LOCAL" "$REMOTE" "$BASE" "$MERGED"
[difftool "bcompare"]
trustExitCode = true
cmd = bcompare "$LOCAL" "$REMOTE"
[mergetool "bcompare"]
trustExitCode = true
cmd = bcompare "$LOCAL" "$REMOTE" "$BASE" "$MERGED"
[difftool "ksdiff"]
cmd = ksdiff --partial-changeset --relative-path \"$MERGED\" -- \"$LOCAL\" \"$REMOTE\"
[mergetool "ksdiff"]
cmd = ksdiff --merge --output \"$MERGED\" --base \"$BASE\" -- \"$LOCAL\" --snapshot \"$REMOTE\" --snapshot
trustExitCode = true
[user]
profiles = ~/.config/git_profiles
[include]
path = .gitconfig_local