-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitconfig
More file actions
105 lines (79 loc) · 3.02 KB
/
.gitconfig
File metadata and controls
105 lines (79 loc) · 3.02 KB
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
[user]
email = "" ; Fill in
name = "" ; Fill in
signingkey = ; Fill in
[gpg]
format = ssh
[tag]
gpgsign = true
[commit]
gpgsign = true
[core]
editor = nvim
autocrlf = input
ignorecase = false
[color]
diff = auto
status = auto
branch = auto
interactive = auto
ui = true
pager = true
[color "status"]
added = green
changed = red bold
untracked = magenta bold
[color "branch"]
remote = yellow
[init]
defaultBranch = main
[pull]
ff = only
# This forces explicit handling of divergent branches, which is ideal for professional open-source repositories because:
# - Prevents accidental merges - Contributors must consciously resolve conflicts
# - Maintains clean main branch - No automatic merge commits cluttering history
# - Enforces workflow discipline - Forces proper branch management and rebasing
# - Reduces integration errors - Failed pulls alert you to conflicts that need attention
# Professional organizations typically want contributors to rebase their feature branches before merging, and fast-forward only enforces this practice by failing when branches have diverged, requiring deliberate action.
[push]
default = simple
autoSetupRemote = true # Eliminates --set-upstream verbose commands
[diff]
algorithm = histogram # Better diff performance and readability
colorMoved = default
[merge]
tool = nvim
[mergetool "nvim"]
cmd = "nvim -d -c 'wincmd l' -c 'norm ]c' '$LOCAL' '$MERGED' '$REMOTE'"
keepBackup = false
prompt = false
[rerere]
enabled = true # Remembers conflict resolutions for repeated merges
[alias]
# Complex log formatting
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'
lgs = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --stat
# Multi-step workflows
sync = !git fetch origin && git rebase origin/main
cleanup = !git branch --merged | grep -v '\\*\\|main\\|master' | xargs -n 1 git branch -d
unstage = reset HEAD --
# Complex status checks
conflicts = diff --name-only --diff-filter=U
modified = ls-files -m
# Stash with message
stash-staged = stash --keep-index
# Recent changes - what happened lately?
recent = log --since='1 week ago' --oneline --author-date-order
# File history - track changes to specific file
file-log = log --follow --patch --
# What changed in last commit?
last = log -1 --stat --pretty=format:'%Cred%h%Creset - %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'
# Compare branches
compare = log --left-right --graph --cherry-pick --oneline
# Quick overview of current branch vs main
ahead = log main..HEAD --oneline
behind = log HEAD..main --oneline
# Show commits that touched specific paths
touched = log --oneline --name-only
# Compact view with file counts
compact = log --pretty=format:'%C(yellow)%h %C(blue)%ad %C(red)%an %C(reset)%s' --date=short --numstat