Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

README.md

Git Configuration

Git configuration template with Delta pager support and useful aliases.

Features

  • Delta Pager: Syntax-highlighted diffs with line numbers (graceful fallback if not installed)
  • Sensible Defaults: Rebase on pull, auto-setup remote, prune on fetch
  • Useful Aliases: Short commands for common operations
  • No Personal Data: Template does NOT include user.name/email
  • Rerere: Remember conflict resolutions for automatic reuse

Installation

The dotfiles installer will set this up:

./install.sh

Or manually:

cp ~/dotfiles/git/gitconfig.template ~/.gitconfig

# Set your personal info (required!)
git config --global user.name "Your Name"
git config --global user.email "your@email.com"

Delta (Optional but Recommended)

Delta provides beautiful syntax-highlighted diffs.

Install Delta

# Cargo (Rust)
cargo install git-delta

# Homebrew (macOS/Linux)
brew install git-delta

# Ubuntu/Debian (download .deb from releases)
# https://github.com/dandavison/delta/releases

# Arch Linux
sudo pacman -S git-delta

The git config will automatically use delta if installed, or fall back to less.

Delta Features

  • Syntax highlighting for 200+ languages
  • Line numbers
  • Word-level diff highlighting
  • Navigate between diff sections with n/N

Aliases Reference

Status & Log

Alias Command Description
s status -sb Short status
lg log --oneline -20 Compact log
lga log --oneline --all --graph Graph log
ll log --pretty=format:... Detailed log
last log -1 HEAD --stat Last commit
today log --since=midnight... Today's commits

Branch

Alias Command Description
b branch -vv Branches with tracking
ba branch -avv All branches
bd branch -d Delete branch
bD branch -D Force delete branch

Commit

Alias Command Description
c commit Commit
cm commit -m Commit with message
ca commit --amend Amend commit
can commit --amend --no-edit Amend without editing
oops add -A && commit --amend --no-edit Add all and amend

Diff

Alias Command Description
d diff Show diff
ds diff --staged Staged diff
dc diff --cached Cached diff

Remote

Alias Command Description
f fetch --all --prune Fetch all
pl pull Pull
ps push Push
pf push --force-with-lease Safe force push

Utilities

Alias Command Description
unstage reset HEAD -- Unstage files
undo reset --soft HEAD~1 Undo last commit
cleanup (script) Delete merged branches
contributors shortlog -sn --all List contributors

Configuration Options

Disable Delta

git config --global core.pager "less -R"

Enable Side-by-Side Diffs

git config --global delta.side-by-side true

Note: Requires a wide terminal (100+ columns recommended).

Change Syntax Theme

# List available themes
delta --list-syntax-themes

# Set theme
git config --global delta.syntax-theme "Nord"

Disable Rebase on Pull

git config --global pull.rebase false

Troubleshooting

Delta not working

  1. Check if delta is installed: delta --version
  2. Verify git config: git config --global core.pager
  3. Test directly: git diff | delta

Interactive staging broken

If git add -p shows errors, ensure the interactive diffFilter uses --color-only:

git config --global interactive.diffFilter "delta --color-only"

Colors look wrong

Ensure your terminal supports 24-bit color:

echo $COLORTERM  # Should be 'truecolor' or '24bit'

Or force true color in git config:

git config --global delta.true-color always