divekit patch
Apply one or more file patches across all repositories of a selected distribution. Supports dry-run and concurrency controls.
The divekit patch
command applies local file changes to all remote repositories of a chosen distribution. It uses the same distribution configuration and authentication resolution as divekit distribute
, including token retrieval from the OS credential manager.
Usage
divekit patch [files...] [flags]
- At least one file path must be provided.
- If
--distribution
is omitted, you will be prompted to select one (interactive flow).
Flags
--distribution <name>
,-d <name>
: Distribution to patch (prompt if omitted)--dry-run <mode>
: Simulate changes without committing- empty or
true
: simulated provider (no remote changes) fs
: use local filesystem provider for previewing changes
- empty or
--message <text>
,-m <text>
: Commit message (default is a timestamped “Patch applied …”)--warn-unresolved-tokens <auto|true|false>
: Warn about unresolved tokens in content (default:auto
)- Concurrency:
--max-workers <int>
: Max concurrent workers (0 = default: 3)--rate-limit-delay <duration>
: Delay between API requests (0 = default: 100ms)--concurrent <bool>
: Enable/disable concurrency (default: true)
- GitLab credentials (usually resolved automatically):
--token
,-t
: GitLab token (optional; retrieved from OS credential store if not provided)--remote
,-r
: GitLab base URL (optional; resolved from host configuration)
--help
: Show help
Notes:
- Tokens are stored in the OS credential manager (Keychain on macOS, Credential Manager on Windows, Secret Service on Linux). Host metadata and token-key references are stored in
~/.divekit/hosts.json
. Configure hosts via:divekit config set @hosts git-nrw https://gitlab.git.nrw/ # prompts for token, stores in OS keychain
Description
For each remote repository in the selected distribution:
- The command loads the provided patch files from your local working directory.
- It individualizes the content per target/remote (respecting distribution tokens and routing markers).
- It compares against the current remote content and creates commits with only the necessary changes.
Patches are applied safely and idempotently:
- Missing files are created.
- Changed files are updated.
- Unchanged files are skipped.
Content is individualized per repository (e.g., tokens replaced, target routing markers stripped) before comparison and commit.
Examples
Apply two files to the “supervisor” distribution
divekit patch --distribution supervisor E2WhateverTests.java pom.xml -m "Make some tests optional"
Dry-run (simulate without committing)
# Simulated provider (no remote changes, logs planned actions)
divekit patch --distribution supervisor E2WhateverTests.java pom.xml --dry-run true
# Filesystem preview mode (fs)
divekit patch --distribution supervisor E2WhateverTests.java pom.xml --dry-run fs
Interactive distribution selection
divekit patch E2WhateverTests.java pom.xml
# Prompts to select a distribution if multiple are detected
Control concurrency
divekit patch --distribution supervisor E2WhateverTests.java --max-workers 5 --rate-limit-delay 250ms
Handle unresolved tokens more strictly
divekit patch --distribution supervisor README.md --warn-unresolved-tokens true
Behavior details
- Individualization: Patch content is individualized per project using the configured token delimiters and per-project selections before diff/commit.
- Routing markers: Target/no-repo routing markers (as configured) are stripped from patch content before commit.
- Commit message: Uses
-m/--message
if provided; otherwise uses a default, timestamped message.
Troubleshooting
- “No remote projects found”:
- Ensure the distribution has remotes configured (remotes.json) and that you selected the correct distribution.
- “Credentials not resolved”:
- Configure a host and token via:
divekit config set @hosts git-nrw https://gitlab.git.nrw/
- Verify token exists in your OS credential manager under “divekit-cli”.
- Configure a host and token via:
- API rate limits:
- Increase
--rate-limit-delay
and/or reduce--max-workers
, or disable concurrency with--concurrent=false
.
- Increase
Last modified September 11, 2025: docs(cli): update documentation to ~current state (9bc308b)