apply
Applies the desired state to repos when a named --action is selected. Without --action, apply behaves like validate and reports drift without writing files.
gitrepoforge apply [flags]
Flags
| Flag | Required | Description |
|---|---|---|
--repo <name> | no | Target a single repo by its directory name. |
--json | no | Output results as JSON instead of human-readable text. |
--action <name> | no | Named action from the action config to use for Git automation. |
Behavior
- Same discovery and validation as
validate. - If
--actionis omitted:- Reports
driftfindings without writing files.
- Reports
- If
--actionis provided:- Resolves the named action from the
actionconfig in.gitrepoforge-config. - For each repo with findings, applies file changes (
create,update,delete), including the generated managed-files manifest at the resolvedmanifestpath. - If Git automation is enabled for the selected action, requires a clean working tree before running Git commands.
- If
on_default_branchistrue, fails the action unless the repo is currently on the branch named by that repo’s.gitrepoforgedefault_branch. - If
create_branchistrue, creates the configured branch from the repo’s current branch. - If
commitistrue, stages and commits the changes. - If
pushistrue, pushes the active branch toremote. - If
pull_requestisGITHUB_CLI, opens a PR viagh pr create --fill. - If
return_to_original_branchistrue, switches back to the original branch. - If
delete_branchistrue, deletes the created branch after returning.
- Resolves the named action from the
--action must match a key under the root config’s action object.
Statuses
| Status | Meaning |
|---|---|
clean | Already compliant and nothing needs to change. |
skipped | No .gitrepoforge file was found. |
invalid | Validation errors prevented apply. |
drift | --action was omitted and the repo differs from the desired state. |
applied | Changes were written successfully, including any configured Git automation. |
failed | An error occurred during Git operations. |
When commit is not enabled in the selected action and a repo is clean, the same compliant (not staged) or compliant (staged, not committed) warnings described in the validate section apply here as well.
See Managed Files Manifest for the generated manifest file format and behavior.