-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitconfig
111 lines (97 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
[user]
name = Björn Nordstrand
email = [email protected]
[commit]
template = ~/.gitconfig-message
[color]
diff = auto
status = auto
interactive = auto
ui = true
pager = true
[color "branch"]
local = yellow
current = brightwhite yellow
remote = normal green
upstream = brightwhite cyan
[alias]
oneline = log --pretty=oneline
stat = log --stat
s = status -s
co = checkout
contributors = shortlog -n -s --no-merges
tree = log --graph --oneline --all
stashbase = !git stash && git rebase $1 && git stash apply
atelog = !git log --pretty=\"format:%at %H\" | sort | sed \"s/.* //\" | git log --stdin
short = log --pretty=format:\"%h %ar [%an] %s\"
cleaner = !git symbolic-ref --short HEAD | xargs git branch --merged | egrep -v '^\\s*\\*?\\s*(master|main)$' | xargs git branch -d
purge-branches = !git_purge_empty_branches.sh
#####
# New commands 2021-02-01
#####
# Get the current branch name (not so useful in itself, but used in
# other aliases)
branch-name = "!git rev-parse --abbrev-ref HEAD"
# Get default branch
default-branch = "!git branch | grep -oE ' main| master'"
mainco = "!git co $(git default-branch)"
mainpo = "!git pull origin $(git default-branch)"
rebma = "!git rebase $(git default-branch)"
feorigin = "!git fetch origin"
# Push the current branch to the remote "origin", and set it to track
# the upstream branch
publish = "!git push -u origin $(git branch-name)"
# Delete the remote version of the current branch
unpublish = "!git push origin :$(git branch-name)"
# Delete a branch and recreate it from master — useful if you have, say,
# a development branch and a master branch and they could conceivably go
# out of sync
recreate = "!f() { [[ -n $@ ]] && git checkout \"$@\" && git checkout $(git default-branch) && git branch -D \"$@\" && git checkout -b \"$@\"; }; f"
# Unstage any files that have been added to the staging area
unstage = reset HEAD
# Show changes that have been staged
diffc = diff --cached
# Checkout our version of a file and add it
ours = "!f() { git checkout --ours $@ && git add $@; }; f"
# Checkout their version of a file and add it
theirs = "!f() { git checkout --theirs $@ && git add $@; }; f"
[core]
attributesfile = ~/.gitattributes
excludesFile = ~/.gitignore
pager = diff-so-fancy | less --tabs=4 -RFX
[push]
default = simple
[pull]
rebase = true
[rebase]
autoStash = true
[diff]
renames = copies
mnemonicprefix = true # Use mnemonic prefixes (index, work tree, commit, object) instead of the standard a and b notation.
[branch]
autosetupmerge = true # When branching off a remote branch, automatically let the local branch track the remote branch.
[rerere]
enabled = true # Enable the recording of resolved conflicts, so that identical hunks can be resolved automatically later on.
[merge]
stat = true # Always show a diffstat at the end of a merge
conflictstyle = diff3
defaultToUpstream = true
[merge "merge-structure-sql"]
name = Rails structure.sql merge driver
driver = git-merge-structure-sql %A %O %B
[color "diff-highlight"]
oldNormal = red bold
oldHighlight = red bold 52
newNormal = green bold
newHighlight = green bold 22
[color "diff"]
meta = 11
frag = magenta bold
commit = yellow bold
old = red bold
new = green bold
whitespace = red reverse
[github]
user = bjonord
[init]
defaultBranch = main