Skip to content

Instantly share code, notes, and snippets.

@vilaca
Last active May 11, 2026 16:38
Show Gist options
  • Select an option

  • Save vilaca/6b9b126cb697bc1e95bef505213a5c4f to your computer and use it in GitHub Desktop.

Select an option

Save vilaca/6b9b126cb697bc1e95bef505213a5c4f to your computer and use it in GitHub Desktop.
Git Worktree Config
[init]
# Use 'main' as the default branch name for new repositories
defaultbranch = main
[pull]
# Rebase local commits on top of fetched changes instead of creating merge commits
rebase = true
[status]
# Use compact output format by default
short = true
# Always show branch and tracking info
branch = true
[fetch]
# Automatically remove remote-tracking refs that no longer exist on the remote
prune = true
[worktree]
# Auto-setup tracking for new worktrees if a matching remote branch exists
guessRemote = true
[alias]
# Show a list of all the files that are being tracked.
show-tracked = ls-tree --name-only -r HEAD
# Stage the file for the next commit, but don't start tracking new files.
stage = add -u
# Make git aware of the existence of the file, but don't automatically stage
# it.
track = add -N
# Unstage the file from the next commit.
# Will also untrack a file that hasn't been commited once, so watch out!
unstage = reset --
# Make git unaware of the existence of the file (automatically unstages,
# since git doesn't know the file anymore)
untrack = rm --cached
# Shortcuts
# Visual log of all branches with topology
l = log --oneline --graph --decorate --all
# c = commit
b = branch -vva
r = remote -v
s = status
sl = status --long
st = stage
ust = unstage
t = track
ut = untrack
a = add
dt = difftool
# Safe force push: won't overwrite commits you haven't seen or incorporated
pf = push --force-with-lease --force-if-includes
f = fetch --all
[core]
# Internal repo format version (standard)
repositoryformatversion = 0
# Track file permission (chmod) changes
filemode = true
# This is a bare repo (no working tree — worktrees are used instead)
bare = true
# Case-insensitive file name matching (required on macOS)
ignorecase = true
# Normalize Unicode filenames (required on macOS)
precomposeunicode = true
sparseCheckout = true
[user]
# Author name for commits
name = Joao Vilaca
# Author email for commits
# email = user@domain.tld
[push]
# Automatically set upstream tracking when pushing a new branch
autoSetupRemote = true
[rerere]
# Remember conflict resolutions and auto-apply them if the same conflict recurs
enabled = true
[rebase]
# Automatically stash and restore uncommitted changes when rebasing
autoStash = true
# Keep stacked branches up to date when rebasing
updateRefs = true
# Auto-reorder fixup!/squash! commits during interactive rebase
autoSquash = true
[merge]
# Show base, ours, and theirs in conflict markers for easier resolution
conflictstyle = zdiff3
[diff]
# Use histogram algorithm for better diffs, especially with moved code
algorithm = histogram
# Highlight moved lines in a different color than added/removed
colorMoved = default
[gc]
# Immediately clean up stale worktree data instead of waiting 3 months
worktreePruneExpire = now
# Rebuild commit graph during gc for faster log/merge-base queries
# On git 2.34+, core.commitGraph and fetch.writeCommitGraph default to true,
# so only gc.writeCommitGraph is needed.
# The graph must be built first: run 'git commit-graph write --reachable'
# or wait for the next gc/fetch to build it automatically.
writeCommitGraph = true
[remote "origin"]
# Remote repository URL
#url = git@domain:owner/repo.git
# Map remote branches to fork/* namespace instead of origin/*
fetch = +refs/heads/*:refs/remotes/origin/*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment