Skip to content

Instantly share code, notes, and snippets.

@9999years
Created May 22, 2025 17:39
Show Gist options
  • Save 9999years/023199a94a541dc1abf2e4ae8cb8e563 to your computer and use it in GitHub Desktop.
Save 9999years/023199a94a541dc1abf2e4ae8cb8e563 to your computer and use it in GitHub Desktop.
gitconfig: the good parts
[core]
# Use a global gitignore file to ignore files in all repositories.
excludesFile = ~/.gitignore_global
[apply]
# Ignore whitespace when applying patches.
ignoreWhitespace = change
[branch]
# When creating a new branch, set it to track the remote branch with the
# same name. Equivalent to adding `--track` to `git branch` and related
# commands.
autoSetupMerge = always
sort = -committerdate
[branch.master]
# The `master` branch follows the `origin` remote by default.
remote = origin
[checkout]
# If you try to checkout `foo` but only `origin/foo` exists, create a new
# branch `foo` tracking `origin/foo` and switch to it.
guess = true
# If you have more than one remote, use `origin` by default when checking
# out.
defaultRemote = origin
[column]
# Arrange output into columns.
ui = auto
[commit]
# When running `git commit`, show the diff you're about to commit at the
# end of the message template. Equivalent to `git commit -v`. The diff is
# not included in the message, it's just there for reference when writing
# the commit message.
verbose = true
[diff]
# Produce better diffs by default.
algorithm = histogram
# Distinguish between lines that were just added/deleted and lines that
# were moved from one file or part of a file to another.
colorMoved = plain
# Replace `a/` and `b/` in your diff header output with where the diff is
# coming from, so `i/` (index), `w/` (working directory), or `c/` (commit).
mnemonicPrefix = true
# Enable rename detection in `git diff` and `git log`.
renames = true
[fetch]
# Remove remote-tracking branches that no longer exist on the remote when fetching.
prune = true
[merge]
# Enable zealous diff3.
# See: https://stackoverflow.com/a/70387424
conflictStyle = zdiff3
[push]
# Push the branch with the same name on the remote by default.
default = simple
# Assume `--set-upstream` when no upstream tracking branch exists for the
# current branch.
autoSetupRemote = true
[rebase]
# If you've made a squash commit with `git commit --squash`, automatically
# squash it onto the relevant commit when rebasing.
autoSquash = true
# If you have changes before rebasing, automatically stash them and then
# apply the stash when you finish rebasing.
autoStash = true
# When a rebasing moves a commit that a branch points to, update the branch
# to point to the new commit.
updateRefs = true
[rerere]
# Reuse recorded resolutions for merge conflicts. Only resolve merge conflicts once!
enabled = true
autoUpdate = true
[tag]
# Sort tags as version numbers, not alphabetically.
sort = version:refname
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment