The bare repository
Why Git tracks the dotfiles in place in $HOME, and what that means for status, ignores, and hooks.
On this page
Git tracks the dotfiles in place: the files in $HOME are the working tree, with no symlinks and no separate clone.
Context
Most dotfile setups keep a clone in a project directory and link each file into $HOME.
The links need a manager, break when a tool replaces a file with a regular one, and hide the real path from editors.
Design
-
A bare repository at
~/.local/share/dotfilesholds the history; it has no working tree of its own. -
Every command passes the working tree explicitly:
--work-tree="$HOME". The repository keepscore.bare=trueand never storescore.worktree, a combination that makes Git warn. -
The
dotfilesalias wraps those options:git --git-dir=$HOME/.local/share/dotfiles --work-tree=$HOME -c diff.relative=falsediff.relative=falseoverrides a global setting, so diffs show paths from$HOMEin every directory. -
Plain
gitin$HOMEfinds no repository. Other repositories under$HOMEand tools that search upward for.gitare unaffected.
Every tracked file lands in $HOME.
Repository-only files therefore live under ~/.config/dotfiles/ and ~/.github/.
Untracked files
$HOME holds thousands of files that the repository never tracks.
The installer sets status.showUntrackedFiles=no, so dotfiles status lists only tracked files;
the doctor fails without it.
The tradeoff: new files stay invisible until you add them by name.
dotfiles add -A or dotfiles add . stages every file below the current directory, including credentials.
Ignore rules
The installer links the repository's info/exclude to the tracked ~/.config/dotfiles/gitignore.
Git reads info/exclude only for its own repository, so these rules never affect other repositories under $HOME.
Changes to the tracked list take effect after the next update without relinking.
Hooks and GIT_DIR
Git runs hooks with the repository's settings, but tools started by a hook search for a .git directory,
and $HOME has none.
The hook installer therefore patches the generated pre-commit hook to export GIT_DIR and GIT_WORK_TREE.
The hooks run through prek.
It reads the same hook definitions as Python pre-commit, here in TOML, and ships as a single binary,
so mise pins it without a Python runtime.
Related
Decisions: ADR-0001.