Skip to content

Instantly share code, notes, and snippets.

@olitreadwell
Created October 9, 2025 01:26
Show Gist options
  • Save olitreadwell/7b068d4d43ae98c71126e47ee05dd884 to your computer and use it in GitHub Desktop.
Save olitreadwell/7b068d4d43ae98c71126e47ee05dd884 to your computer and use it in GitHub Desktop.
global gitconfig
# Global Git Configuration File
#
# IMPORTANT: To enable/disable an option, simply remove or add the '#' or ';' at the beginning of the line.
#
# Sections are separated by ' for readability.
#
# --- User Identity ---
[user]
# Sets the name to be associated with your commits.
name = Oli Treadwell
# Sets the email address for your commits.
email = [email protected]
# --- Aliases ---
[alias]
# Shortcuts for common Git commands.
# co = checkout
# ci = commit
# st = status
# br = branch
# lg = log --oneline --graph --decorate
# hist = log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short
# type = cat-file -t
# dump = cat-file -p
# # Create a new branch and switch to it in one go.
# cob = checkout -b
# # Pushes the current branch and sets the upstream remote.
# push-u = push --set-upstream origin $(git rev-parse --abbrev-ref HEAD)
# --- Core Settings ---
[core]
# Controls line endings to prevent cross-platform issues.
# 'input': Converts CRLF to LF on commit. Recommended for macOS/Linux.
# '; autocrlf = true': Converts LF to CRLF on checkout. Recommended for Windows.
autocrlf = input
# Sets your default text editor for commit messages and other operations.
# editor = vim
# For Visual Studio Code, use this line instead:
editor = code --wait
# Controls how Git displays output that doesn't fit on one screen.
pager = less -F -X
# Prevents Git from tracking changes to a file's executable bit.
# Useful on multi-user systems.
filemode = false
# Highlights common whitespace issues like a space before a tab or a trailing carriage return.
whitespace = cr-at-eol
# --- Push and Pull Behavior ---
[push]
# Controls the behavior of 'git push'.
# 'simple' is the recommended setting. It pushes the current branch to its upstream branch with the same name.
default = simple
# Automatically sets up the upstream tracking branch on the first 'git push' of a new branch.
autoSetupRemote = true
[pull]
# Rebase is often preferred over merge for a cleaner, more linear history.
# 'rebase' will automatically rebase your changes on top of the remote changes when you 'git pull'.
rebase = false
# --- Color Settings ---
[color]
# Enables color for all Git output, making it easier to read status, diffs, and logs.
ui = auto
# --- Rebase ---
[rebase]
# Automatically stashes local changes before a rebase and re-applies them afterwards.
autoStash = true
# Automatically marks 'fixup!' and 'squash!' commits for you during an interactive rebase.
autoSquash = true
# --- Diff Tool ---
[diff]
# Sets the external diff tool to use with 'git difftool'.
# 'vscode' is an alias defined below.
tool = vscode
# For using Vim, use this line instead:
# ; tool = vimdiff
[difftool "vscode"]
# The actual command to run for the 'vscode' diff tool.
# Git replaces $LOCAL and $REMOTE with the file paths.
cmd = code --wait --diff $LOCAL $REMOTE
# --- Commit Template ---
[commit]
# Use a template to enforce a consistent commit message format.
# The file path is relative to your home directory.
template = ~/.gitmessage.txt
[filter "lfs"]
process = git-lfs filter-process
required = true
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment