-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.gitconfig
144 lines (125 loc) · 4.63 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
132
133
134
135
136
137
138
139
140
141
142
143
[alias]
# View the SHA, description, and history graph of the latest 20 commits
l = log --pretty='format:%C(yellow)%h %Creset- %C(white)%s %C(bold blue)[%an]%Creset %Cgreen%cr' -n 20 --graph
ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --numstat
# View the current working tree status using the short format
s = status -s
# Show the diff between the latest commit and the current state
d = !"git diff-index --quiet HEAD -- || clear; git diff --patch-with-stat"
# `git di $number` shows the diff between the state `$number` revisions ago and the current state
di = !"d() { git diff --patch-with-stat HEAD~$1; }; git diff-index --quiet HEAD -- || clear; d"
# List modified files in last commit
dl = "!git ll -1"
# Diff with patience
dip = diff --patience
# Pull in remote changes for the current repository and all its submodules
p = !"git pull; git submodule foreach git pull origin master"
# Clone a repository including all submodules
c = clone --recursive
# Commit all changes
ca = !git add -A && git commit -av
# Switch to and track remote branch
go = checkout --track
# Create named branches
feature = "!f() { git checkout -b feature/$1; }; f"
refactor = "!f() { git checkout -b refactor/$1; }; f"
bug = "!f() { git checkout -b bug/$1; }; f"
# Show verbose output about tags, branches or remotes
tags = tag -l
branches = branch -a
remotes = remote -v
# Credit an author on the latest commit
credit = "!f() { git commit --amend --author \"$1 <$2>\" -C HEAD; }; f"
# Interactive rebase with the given number of latest commits
reb = "!r() { git rebase -i HEAD~$1; }; r"
# Uncommit
uncommit = reset --soft HEAD~1
# Undo a `git push`
undopush = push -f origin HEAD^:master
# Search through codebase
grep = grep -Ii
# Search from root folder
gra = "!f() { A=$(pwd) && TOPLEVEL=$(git rev-parse --show-toplevel) && cd $TOPLEVEL && git grep --full-name -In $1 | xargs -I{} echo $TOPLEVEL/{} && cd $A; }; f"
# Grep on filename
f = "!git ls-files | grep -i"
# reset to last commit on HEAD
stfu = reset --hard HEAD
# delete local branches if remote branch was deleted
prune = fetch --prune
# prune tracked branches on origin
prn = remote prune origin
# help with merging
ours = "!f() { git checkout --ours $@ && git add $@; }; f"
theirs = "!f() { git checkout --theirs $@ && git add $@; }; f"
# temporarily ignore files
assume = update-index --assume-unchanged
unassume = update-index --no-assume-unchanged
assumed = "!git ls-files -v | grep ^h | cut -c 3-"
# stash a snapshot
snapshot = !git stash save "snapshot: $(date)" && git stash apply "stash@{0}"
# stash includes untracked files
stash-all = stash save --include-untracked
stash-unstaged = stash -k
# Delete all local branches but master and the current one, only if they are fully merged with master.
branch-cleanup = "!f(){\
git branch | grep -v "master" | grep -v ^* | xargs git branch -d;\
}; f"
# Delete all local branches but master and the current one.
branch-cleanup-force = "!f(){\
git branch | grep -v "master" | grep -v ^* | xargs git branch -D;\
}; f"
# list aliases
aliases = "!git config -l | grep alias | cut -c 7-"
shortcuts = "!git aliases"
# commitizen
cz = "npx git-cz"
[color]
ui = auto
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow black
frag = magenta black
old = red black
new = green black
[color "status"]
plain = white
added = yellow
changed = green
untracked = cyan
[commit]
# Verify commits using gpg key
gpgSign = true
[diff]
tool = vimdiff
[difftool]
prompt = false
[merge]
log = true
tool = diffconflicts
[mergetool]
keepBackup = false
[mergetool "diffconflicts"]
cmd = vim -c DiffConflicts \"$MERGED\" \"$BASE\" \"$LOCAL\" \"$REMOTE\"
trustExitCode = true
[push]
default = simple
followTags = true
[status]
# show untracked files inside newly created folders
showUntrackedFiles = all
[core]
editor = nvim
excludesfile = ~/.dotfiles/.gitignore
# Treat spaces before tabs, lines that are indented with 8 or more spaces, and all kinds of trailing whitespace as an error
whitespace = space-before-tab,indent-with-non-tab,trailing-space
[log]
abbrevCommit = true
date = short
[web]
browser = google-chrome
[merge "npm-merge-driver"]
name = automatically merge npm lockfiles
driver = npx npm-merge-driver merge %A %O %B %P