Skip to content

Latest commit

 

History

History
185 lines (124 loc) · 3.5 KB

File metadata and controls

185 lines (124 loc) · 3.5 KB

Git

This repository includes a reusable Git configuration focused on a predictable, clean, and efficient daily workflow.

The versioned configuration is stored in:

configs/git/.gitconfig

Personal identity, credentials, signing keys, and account-specific settings must remain in the user's global Git configuration and must not be committed.

Installation

The mac setup command configures this automatically and correctly for your installation path.

To configure it manually, set the path to match wherever you cloned this repository:

REPO_DIR="$HOME/path/to/mac-dev-setup"
git config --global include.path "$REPO_DIR/configs/git/.gitconfig"

Verify:

git config --global --get include.path

Default branch

New repositories use main as their initial branch:

[init]
    defaultBranch = main

Fetch and pull behavior

Deleted remote branches are pruned automatically during fetch operations:

[fetch]
    prune = true

Pull operations use rebase instead of creating an automatic merge commit:

[pull]
    rebase = true

Local changes are temporarily stashed and restored during rebases:

[rebase]
    autoStash = true

Push behavior

The first push of a new branch automatically creates its upstream tracking branch:

[push]
    autoSetupRemote = true

Conflict resolution

Git remembers previous conflict resolutions:

[rerere]
    enabled = true
    autoupdate = true

Previously recorded resolutions may be reapplied and staged automatically.

Merge conflicts use the zdiff3 style:

[merge]
    conflictStyle = zdiff3

Branch and tag display

Branches are sorted by most recent commit date:

[branch]
    sort = -committerdate

Tags are sorted using version-aware ordering:

[tag]
    sort = version:refname

Lists use columns when appropriate:

[column]
    ui = auto

Command assistance

Git prompts before applying a suggested correction for a mistyped command:

[help]
    autocorrect = prompt

Diff and commit display

Moved lines are highlighted more clearly in diffs:

[diff]
    colorMoved = zebra

Interactive commits display the diff below the commit message editor:

[commit]
    verbose = true

Git Delta is configured separately in the same file and provides the default pager and enhanced diff rendering.

git diff rendered with delta

Validation

Validate the configuration syntax:

git config --file configs/git/.gitconfig --list >/dev/null \
  && echo "Git configuration is valid."

Inspect the effective configuration:

git config --global --includes --list --show-origin

Inspect only the workflow-related settings:

git config --global --includes --get-regexp \
  '^(init\.|fetch\.|pull\.|rebase\.|push\.|rerere\.|branch\.|tag\.|column\.|help\.|diff\.|commit\.|merge\.|core\.|interactive\.|delta\.)'

Rollback

Remove the include from the global Git configuration (use the same path you set during installation):

REPO_DIR="$HOME/path/to/mac-dev-setup"
git config --global --fixed-value --unset-all include.path \
  "$REPO_DIR/configs/git/.gitconfig"

Review the global configuration afterward:

git config --global --list --show-origin

Removing the include disables the versioned settings without deleting personal identity or credential configuration.


← Docs index · Project README