Git Flow Release
Prepare and publish one repository release while discovering branch names, version sources, metadata, checks, and remote conventions from the repository instead of assuming project-specific paths.
Discover repository conventions
- Read repository instructions and release documentation before deciding the workflow.
- Resolve the production and development branches in this order:
- Git Flow config such as
gitflow.branch.master and gitflow.branch.develop;
- explicit repository documentation;
- the remote default branch plus an existing development branch.
- Resolve the release branch prefix and tag prefix from Git Flow config, existing release branches, stable SemVer tags, and repository documentation. Default to
release/ only when no conflicting convention exists.
- Discover release metadata and verification requirements from repository instructions, CI workflows, release scripts, changelogs, manifests, version files, and roadmap or milestone documents.
- Stop and ask when production/development branches, tag format, release graph, or version sources remain materially ambiguous. Never impose
main, develop, a v prefix, or a specific changelog layout without evidence.
Resolve the version
- Accept an explicit version or a release branch containing a stable three-part SemVer
X.Y.Z.
- Preserve the repository's established tag prefix, such as
X.Y.Z or vX.Y.Z.
- Never silently change an explicitly supplied version.
When no version is supplied:
- Fetch the remote and tags, then identify the highest stable SemVer tag under the repository's tag convention.
- Inspect changes since that tag and any planned version in manifests, milestones, changelogs, or release branches.
- Prefer a documented unreleased version when the included work completes that release. Otherwise apply SemVer from the actual change scope.
- Ask the user when multiple versions remain plausible or the breaking-change boundary is unclear.
Verify that the resolved version is newer than the latest stable release and that its local tag, remote tag, local release branch, and remote release branch do not conflict. Never move or replace a published tag; prepare a new patch or hotfix version instead.
Gate release metadata
Treat repository-required release metadata as part of the release:
- Identify every required changelog, manifest, version constant, lockfile, roadmap, generated file, or release-note artifact.
- Derive entries only from changes included since the latest production tag and follow the repository's rules for user-facing versus internal changes.
- Include exact proposed release-note text and metadata edits in the confirmation plan when wording requires user review.
- After confirmation, update metadata on the release branch, format it, run its targeted checks, and commit it using repository conventions.
- Before tagging, verify that all authoritative version sources and release notes agree with the target version.
When the repository requires no metadata change, state that explicitly in the confirmation plan. Do not invent changelog files or version sources.
Require confirmation
Always stop for explicit confirmation before switching or creating branches, committing release metadata, merging, tagging, pushing, or deleting a release branch. Fetching and read-only inspection are allowed before this gate. The initial request to “release” or “finish” is not confirmation.
Present one exact release plan containing:
- resolved version, release branch, tag, production branch, and development branch;
- evidence for the version and conventions;
- commits and working-tree changes included;
- release metadata and exact proposed notes, or the explicit no-metadata decision;
- checks already run, targeted checks still required, and the authoritative post-push CI gate;
- refs to push and local or remote release branches to delete.
If any version, content, ref, metadata, or deletion scope changes afterward, present the updated plan and confirm again.
Run preflight
- Fetch and prune the release remote, including tags.
- Inspect the current branch, upstreams, worktree, local refs, and remote refs.
- Continue with a clean worktree. Include clearly related dirty changes in the confirmation plan without staging them; stop for unrelated, overlapping, or ambiguous changes.
- Check whether production and development branches are behind or diverged from their upstreams. Do not update them before confirmation and never rewrite history.
- Confirm the target tag is absent locally and remotely.
- Locate the release branch locally and remotely without creating, switching, or updating it.
- Stop for conflicts, ambiguous ancestry, unexpected refs, protected-branch constraints that prevent the workflow, or an existing target tag.
After confirmation, fast-forward production and development branches only when safe. Track an existing remote release branch without discarding commits, or create a short-lived release branch from the up-to-date development branch when none exists. Commit only confirmed metadata or in-scope changes and require a clean worktree before finishing.
Verify proportionally
- Format every changed formatter-managed file before verification.
- Run repository-required release checks and targeted checks for metadata and application changes not already verified.
- Run
git diff --check for outgoing ranges.
- Use the repository's CI workflow as the authoritative full gate when documented.
- Do not repeat the complete local CI suite solely for ceremony unless the user requests it, CI is unavailable, or unverified high-risk changes justify it.
- Stop before publishing when required checks fail unless the user explicitly accepts a repository-supported exception.
Finish the release
Prefer the repository's documented release graph. When none is documented, use this default:
release/X.Y.Z --merge --no-ff--> production --annotated tag--> TAG
\
merge TAG --no-ff--> development
Run non-interactive Git operations in this order:
- Switch to the production branch.
- Merge the release branch with
--no-ff and a conventional merge message.
- Create the annotated release tag on the production merge commit.
- Switch to the development branch.
- Merge the tag with
--no-ff so development contains the exact published release.
- Delete the local release branch only after both merges and the tag succeed and only when confirmed.
- Inspect the graph, tag target, branch containment, outgoing ranges, and worktree cleanliness.
If the repository uses a different documented Git Flow graph, follow it and show that graph in the confirmation plan. A Git Flow CLI may be used only when its result matches the confirmed graph; prefer explicit Git commands when the CLI is unavailable or interactive.
Publish and verify refs
- Push the production branch, development branch, and release tag to the confirmed remote in one explicit command when supported.
- Delete the remote release branch only when it existed before finishing, deletion was confirmed, and the release refs were pushed successfully.
- Fetch or query remote refs and verify every published ref points to the expected commit.
- Never force-push, rewrite history, move a tag, delete another branch, create a hosting-platform release, or start a deployment unless explicitly requested or required by documented repository automation.
- Treat successful ref verification as completion. Do not poll CI or deployment by default unless the user asks.
Report the result
Report only verified outcomes:
- production merge commit and branch;
- annotated tag and target;
- development merge-back commit and branch;
- pushed refs and remote;
- release metadata version and notes status;
- local or remote release branch deletion;
- checks actually run and any asynchronous CI or deployment not monitored.
Never claim a deployment succeeded merely because release refs were pushed.
1---2name: git-flow-release3description: Prepare, finish, and publish a repository release that follows Git Flow, with or without an explicit SemVer version. Use when the user asks to create or finish a release branch, infer the next release version, merge a release into the production and development branches, create and push a release tag, or publish the completed Git Flow refs. Do not use for ordinary commits or pushes, pull requests, release-notes-only work, deployments without a Git release, history rewriting, or force-pushes.4---56# Git Flow Release78Prepare and publish one repository release while discovering branch names, version sources, metadata, checks, and remote conventions from the repository instead of assuming project-specific paths.910## Discover repository conventions11121. Read repository instructions and release documentation before deciding the workflow.132. Resolve the production and development branches in this order:14 - Git Flow config such as `gitflow.branch.master` and `gitflow.branch.develop`;15 - explicit repository documentation;16 - the remote default branch plus an existing development branch.173. Resolve the release branch prefix and tag prefix from Git Flow config, existing release branches, stable SemVer tags, and repository documentation. Default to `release/` only when no conflicting convention exists.184. Discover release metadata and verification requirements from repository instructions, CI workflows, release scripts, changelogs, manifests, version files, and roadmap or milestone documents.195. Stop and ask when production/development branches, tag format, release graph, or version sources remain materially ambiguous. Never impose `main`, `develop`, a `v` prefix, or a specific changelog layout without evidence.2021## Resolve the version2223- Accept an explicit version or a release branch containing a stable three-part SemVer `X.Y.Z`.24- Preserve the repository's established tag prefix, such as `X.Y.Z` or `vX.Y.Z`.25- Never silently change an explicitly supplied version.2627When no version is supplied:28291. Fetch the remote and tags, then identify the highest stable SemVer tag under the repository's tag convention.302. Inspect changes since that tag and any planned version in manifests, milestones, changelogs, or release branches.313. Prefer a documented unreleased version when the included work completes that release. Otherwise apply SemVer from the actual change scope.324. Ask the user when multiple versions remain plausible or the breaking-change boundary is unclear.3334Verify that the resolved version is newer than the latest stable release and that its local tag, remote tag, local release branch, and remote release branch do not conflict. Never move or replace a published tag; prepare a new patch or hotfix version instead.3536## Gate release metadata3738Treat repository-required release metadata as part of the release:39401. Identify every required changelog, manifest, version constant, lockfile, roadmap, generated file, or release-note artifact.412. Derive entries only from changes included since the latest production tag and follow the repository's rules for user-facing versus internal changes.423. Include exact proposed release-note text and metadata edits in the confirmation plan when wording requires user review.434. After confirmation, update metadata on the release branch, format it, run its targeted checks, and commit it using repository conventions.445. Before tagging, verify that all authoritative version sources and release notes agree with the target version.4546When the repository requires no metadata change, state that explicitly in the confirmation plan. Do not invent changelog files or version sources.4748## Require confirmation4950Always stop for explicit confirmation before switching or creating branches, committing release metadata, merging, tagging, pushing, or deleting a release branch. Fetching and read-only inspection are allowed before this gate. The initial request to “release” or “finish” is not confirmation.5152Present one exact release plan containing:5354- resolved version, release branch, tag, production branch, and development branch;55- evidence for the version and conventions;56- commits and working-tree changes included;57- release metadata and exact proposed notes, or the explicit no-metadata decision;58- checks already run, targeted checks still required, and the authoritative post-push CI gate;59- refs to push and local or remote release branches to delete.6061If any version, content, ref, metadata, or deletion scope changes afterward, present the updated plan and confirm again.6263## Run preflight64651. Fetch and prune the release remote, including tags.662. Inspect the current branch, upstreams, worktree, local refs, and remote refs.673. Continue with a clean worktree. Include clearly related dirty changes in the confirmation plan without staging them; stop for unrelated, overlapping, or ambiguous changes.684. Check whether production and development branches are behind or diverged from their upstreams. Do not update them before confirmation and never rewrite history.695. Confirm the target tag is absent locally and remotely.706. Locate the release branch locally and remotely without creating, switching, or updating it.717. Stop for conflicts, ambiguous ancestry, unexpected refs, protected-branch constraints that prevent the workflow, or an existing target tag.7273After confirmation, fast-forward production and development branches only when safe. Track an existing remote release branch without discarding commits, or create a short-lived release branch from the up-to-date development branch when none exists. Commit only confirmed metadata or in-scope changes and require a clean worktree before finishing.7475## Verify proportionally7677- Format every changed formatter-managed file before verification.78- Run repository-required release checks and targeted checks for metadata and application changes not already verified.79- Run `git diff --check` for outgoing ranges.80- Use the repository's CI workflow as the authoritative full gate when documented.81- Do not repeat the complete local CI suite solely for ceremony unless the user requests it, CI is unavailable, or unverified high-risk changes justify it.82- Stop before publishing when required checks fail unless the user explicitly accepts a repository-supported exception.8384## Finish the release8586Prefer the repository's documented release graph. When none is documented, use this default:8788```text89release/X.Y.Z --merge --no-ff--> production --annotated tag--> TAG90 \91 merge TAG --no-ff--> development92```9394Run non-interactive Git operations in this order:95961. Switch to the production branch.972. Merge the release branch with `--no-ff` and a conventional merge message.983. Create the annotated release tag on the production merge commit.994. Switch to the development branch.1005. Merge the tag with `--no-ff` so development contains the exact published release.1016. Delete the local release branch only after both merges and the tag succeed and only when confirmed.1027. Inspect the graph, tag target, branch containment, outgoing ranges, and worktree cleanliness.103104If the repository uses a different documented Git Flow graph, follow it and show that graph in the confirmation plan. A Git Flow CLI may be used only when its result matches the confirmed graph; prefer explicit Git commands when the CLI is unavailable or interactive.105106## Publish and verify refs1071081. Push the production branch, development branch, and release tag to the confirmed remote in one explicit command when supported.1092. Delete the remote release branch only when it existed before finishing, deletion was confirmed, and the release refs were pushed successfully.1103. Fetch or query remote refs and verify every published ref points to the expected commit.1114. Never force-push, rewrite history, move a tag, delete another branch, create a hosting-platform release, or start a deployment unless explicitly requested or required by documented repository automation.1125. Treat successful ref verification as completion. Do not poll CI or deployment by default unless the user asks.113114## Report the result115116Report only verified outcomes:117118- production merge commit and branch;119- annotated tag and target;120- development merge-back commit and branch;121- pushed refs and remote;122- release metadata version and notes status;123- local or remote release branch deletion;124- checks actually run and any asynchronous CI or deployment not monitored.125126Never claim a deployment succeeded merely because release refs were pushed.