Applying overlays
Apply overlays to a git repository from a local directory, a GitHub URL, or a configured source.
Basic usage
Section titled “Basic usage”To start, browse overlays from a GitHub username. repoverlay gets the available overlays and shows a selection menu:
repoverlay browse tylerbutlerTo apply an overlay without the selection menu, specify a local directory, GitHub URL, or configured overlay reference:
# Local directoryrepoverlay apply /path/to/overlay
# GitHub repositoryrepoverlay apply https://github.com/owner/repoWhere overlays come from
Section titled “Where overlays come from”repoverlay selects the source type from the value you give to browse or apply:
- A value that starts with
https://github.com/specifies a GitHub URL. - A file path that starts with
./,/, or~/specifies a local directory. - A three-part value such as
org/repo/namespecifies a configured source reference. - A two-part value such as
owner/repoopens a selection menu. - A single word such as
tylerbutlerspecifies a GitHub username.
GitHub usernames
Section titled “GitHub usernames”repoverlay browse tylerbutlerThis command gets the default overlay repository for that user. It shows a selection menu with overlays for your current repository. The first time you use a source, repoverlay asks if you want to save it for future use.
A username alone expands to username/repo-overlays. To use a different repository name, set the REPOVERLAY_DEFAULT_REPO_NAME environment variable. For example, REPOVERLAY_DEFAULT_REPO_NAME=overlays expands tylerbutler to tylerbutler/overlays.
GitHub URLs
Section titled “GitHub URLs”# Default branchrepoverlay apply https://github.com/owner/repo
# Specific branch or tagrepoverlay apply https://github.com/owner/repo --ref developrepoverlay apply https://github.com/owner/repo/tree/v1.0.0
# Subdirectory within a reporepoverlay apply https://github.com/owner/repo/tree/main/overlays/rustrepoverlay stores GitHub sources locally as shallow clones. Use repoverlay update to get new changes later.
Configured source references
Section titled “Configured source references”If you have used a source before or added one manually, you can specify an overlay by its path:
repoverlay apply org/repo/overlay-nameLocal directories
Section titled “Local directories”repoverlay apply /path/to/overlayrepoverlay apply ./relative/overlayrepoverlay creates symlinks directly to the source files. Changes to the source appear immediately in the target repository.
Managing sources
Section titled “Managing sources”When you apply from a username or owner/repo for the first time, repoverlay prompts you to save the source. You can also manage sources manually:
# Add a sourcerepoverlay source add tylerbutler
# List configured sourcesrepoverlay source list
# Remove a sourcerepoverlay source remove tylerbutlerrepoverlay checks sources in priority order to resolve overlay references. Earlier sources have higher priority.
Local directory sources can use the shared org/repo/overlay-name/ layout or a flat
layout. In a flat layout, each top-level directory is an overlay. If there are no
top-level overlay directories, repoverlay uses the source directory itself as one overlay.
Conflict handling
Section titled “Conflict handling”If an overlay file conflicts with an existing file in the repo, repoverlay fails by default. You can control this behavior:
--force
Section titled “--force”Overwrite existing files:
repoverlay apply ./overlay --force--skip-conflicts
Section titled “--skip-conflicts”Skip conflicting files silently and continue with the rest:
repoverlay apply ./overlay --skip-conflicts--interactive
Section titled “--interactive”Choose an action for each conflict:
repoverlay apply ./overlay --interactive--merge (JSON deep merge)
Section titled “--merge (JSON deep merge)”For JSON files, use a deep merge to combine the overlay content with the existing file:
repoverlay apply ./overlay --mergeUse this option to add default settings to the existing repository configuration. For example, an overlay can add recommended VS Code extensions to an existing .vscode/settings.json.
A deep merge combines objects recursively. It adds or updates overlay keys and keeps existing keys that are not in the overlay.
Merge targets must be real files with paths relative to the repository. repoverlay rejects symlinks in the target or its parent directories. For non-JSON files, --merge has no effect. repoverlay treats these files as conflicts.
To use merging by default, set the REPOVERLAY_MERGE=true environment variable. This sets the default for --merge in apply, switch, restore, and update.
Other options
Section titled “Other options”Copy mode
Section titled “Copy mode”Use --copy to copy files instead of creating symlinks:
repoverlay apply ./overlay --copyCustom overlay name
Section titled “Custom overlay name”repoverlay generates a name from the source. Use --name to set a different name:
repoverlay apply ./overlay --name my-configTarget directory
Section titled “Target directory”By default, repoverlay applies overlays to the current directory. Use --target to apply an overlay to a different repository:
repoverlay apply ./overlay --target /path/to/repoDry run
Section titled “Dry run”Preview what would happen without making changes:
repoverlay apply ./overlay --dry-run