git-overlay
Manage overlay files across git repositories. Move untracked files (configs, secrets, local overrides) into a central overlay repository and replace them with symlinks. The overlay repo is committed and pushed automatically so the files travel with you across machines.
Requires a Unix-like operating system (macOS, Linux).
Installation
From a local checkout:
Setup
Initialise the overlay repo. This clones the remote and writes the config
file at ~/.config/git-overlay.yml:
The config file is a simple YAML file:
repo: ~/overlay
You can also set the GIT_OVERLAY_CONFIG environment variable to point to a
different config file.
Usage
All commands are run from inside a project repository. The project's origin
remote URL is used to derive the overlay subdirectory
(e.g. myorg/myproject).
Add files to the overlay
Each file is copied into the overlay repo, replaced with a symlink, and the
path is added to .git/info/exclude. The overlay repo is committed and pushed
automatically.
The overlay repo must be clean (no uncommitted changes) before running add
or rm.
Apply overlay (create symlinks)
Re-creates symlinks for all overlay entries. Run this after cloning a project
or after git-overlay pull.
List overlay entries
Shows all overlay entries for the current project. Modified and deleted entries are highlighted.
Remove files from the overlay
Copies the file back from the overlay, removes the symlink, and removes the entry from the overlay repo.
Clear overlay symlinks
Removes all overlay symlinks from the current project. The files remain in the
overlay repo so they can be re-applied later with git-overlay apply.
With --remove, the entries are also deleted from the overlay repository and
the change is committed and pushed.
Save changes
Commits and pushes any modifications to overlay files for the current project.
Pull / Push
Pull or push the overlay repository.
Dry run
Most commands support --dry-run to preview what would happen without making
any changes:
How it works
addcopies files into<overlay-repo>/<org>/<project>/and replaces the originals with symlinks pointing into the overlay.- Paths are added to
.git/info/excludeso git ignores the symlinks. - The overlay repo is a regular git repository -- changes are committed and
pushed automatically on
add,rm, andsave. applyre-creates the symlinks (useful after a fresh clone or apull).
License
MIT