Skip to content

Instantly share code, notes, and snippets.

@santhosh-chinnasamy
Last active April 9, 2024 10:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save santhosh-chinnasamy/269d589d056efc4cc7d8af832fd235db to your computer and use it in GitHub Desktop.
Save santhosh-chinnasamy/269d589d056efc4cc7d8af832fd235db to your computer and use it in GitHub Desktop.
~/.gitconfig
[includeIf "gitdir/i:~/"] # Personal
path = ~/.git-personal.conf
[includeIf "gitdir:~/Workspace/"]
path = ~/.git-tw.conf
[includeIf "gitdir:~/Workspace/apollo-io/"]
path = ~/.git-apollo.conf
[alias]
# compress disk-space-usage by deleting dangling commits
# Note: Do not use '--all' switch for reflog expire - since that also destroys stashes
cc = "!echo \"Size before: $(du -sh .git | cut -f1)\"; git remote prune origin; git repack; git prune-packed; git reflog expire --all --expire=1.week.ago; git maintenance run --task=gc; echo \"Size after: $(du -sh .git | cut -f1)\";"
# find dangling commits
dangling = fsck --no-reflog
# edit global git configuration
ec = config --global -e
lg = log --color --graph --pretty=format:'%C(yellow)%h%Creset | %C(bold blue)%d%Creset %s | %C(green) %an, %cr%Creset' --abbrev-commit
tgl = tag -l --sort=-creatordate --format '%(refname:strip=2) @ %(objectname:short) on %(creatordate)'
# undo the last commit
undo = reset --soft HEAD^
[branch]
autoSetupMerge = true
autoSetupRebase = always
# sort branches by last commit date
sort = committerdate
[core]
excludesfile = /Users/santhosh/.gitignore
editor = code --wait
[diff]
compactionHeuristic = true
renames = true
renameLimit = 1000
colorMoved = default
submodule = diff
[fetch]
prune = true
pruneTags = true
parallel = 0
showForcedUpdates = true
[gc]
auto = 2000
pruneExpire = now
worktreePruneExpire = 1.weeks.ago
reflogExpire = 2.weeks.ago
reflogExpireUnreachable = 2.weeks.ago
rerereResolved = 1.weeks.ago
[init]
defaultBranch = main
# templatedir = /Users/santhosh/.git-template
[merge]
defaultToUpstream = true
# ff = only
# renamelimit = 15000
autoStash = true
[pull]
rebase = true
autoStash = true
[rebase]
autoSquash = true
autoStash = true
missingCommitsCheck = error
abbreviateCommands = true
[rerere]
enabled = true
autoUpdate= true
[stash]
untracked = true
showIncludeUntracked = true
showPatch = true
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment