Repository navigation
DOC: State the release-branch merge-forward rules for agents #7233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,77 @@ | ||||||||||||||
| # Release Branches and Backports | ||||||||||||||
|
|
||||||||||||||
| ITK keeps every maintenance branch connected to `main` by merging forward. | ||||||||||||||
| The human procedure is in | ||||||||||||||
| [contributing/index.md](../docs/contributing/index.md#merge-a-bug-fix-for-a-patch-release) | ||||||||||||||
| and [Release.md](../Maintenance/Release.md#integrate-bug-fixes-in-the-release-branch); | ||||||||||||||
| this page states the rules and the checks. Tiers follow | ||||||||||||||
| [rule-tiers.md](./rule-tiers.md). | ||||||||||||||
|
|
||||||||||||||
| ## Branches | ||||||||||||||
|
|
||||||||||||||
| | Branch | Holds | | ||||||||||||||
| |---|---| | ||||||||||||||
| | `main` | Development | | ||||||||||||||
| | `release` | The newest release and its next patch release | | ||||||||||||||
| | `release-X.X` | One older series, e.g. `release-5.4` for ITK 5 | | ||||||||||||||
|
|
||||||||||||||
| ## Where a fix starts | ||||||||||||||
|
|
||||||||||||||
| | The fix is for | Branch from, and open the PR against | | ||||||||||||||
| |---|---| | ||||||||||||||
| | New development | `main` | | ||||||||||||||
| | The next patch of the newest release | `release` | | ||||||||||||||
| | An older series | that `release-X.X` | | ||||||||||||||
| | A fix already merged on `main` | `release` or `release-X.X`; cherry-pick the `main` commit onto the topic | | ||||||||||||||
|
|
||||||||||||||
| A cherry-picked fix appears twice in history after the merge forward. That is | ||||||||||||||
| expected. | ||||||||||||||
|
|
||||||||||||||
| ## Merge forward | ||||||||||||||
|
|
||||||||||||||
| Every change on a maintenance branch reaches `main` by merge, never by | ||||||||||||||
| cherry-pick alone: | ||||||||||||||
|
|
||||||||||||||
| ``` | ||||||||||||||
| release-X.X → release → main (each step git merge --no-ff) | ||||||||||||||
| ``` | ||||||||||||||
|
|
||||||||||||||
| - Each step is its own pull request, so each conflict resolution is reviewed | ||||||||||||||
| on its own. | ||||||||||||||
| - A conflict where `main` already holds the fix in a newer form resolves to | ||||||||||||||
| `main`'s version. After resolving, `git diff upstream/main HEAD` shows only | ||||||||||||||
| what the maintenance branch adds (release notes, a version-specific | ||||||||||||||
| change); anything else is a resolution error. | ||||||||||||||
| - List every conflict and its resolution in the merge PR body. | ||||||||||||||
| - Never rebase or force-push `release` or `release-X.X`. | ||||||||||||||
|
|
||||||||||||||
| After a patch release is tagged, merge forward so the tag is an ancestor of | ||||||||||||||
| `main`. Merging sooner keeps each merge small: conflicts accumulate while a | ||||||||||||||
| maintenance branch goes unmerged. | ||||||||||||||
|
|
||||||||||||||
| ## Checking conformance | ||||||||||||||
|
|
||||||||||||||
| Each command prints nothing when the branches conform: | ||||||||||||||
|
|
||||||||||||||
| ```bash | ||||||||||||||
| git fetch upstream --tags | ||||||||||||||
| git log --oneline --no-merges upstream/release..upstream/release-5.4 | ||||||||||||||
| git log --oneline --no-merges upstream/main..upstream/release | ||||||||||||||
| git log --oneline --no-merges upstream/main..upstream/release-5.4 | ||||||||||||||
|
Comment on lines
+58
to
+60
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Remove
Suggested change
|
||||||||||||||
| for t in $(git ls-remote --tags --refs upstream 'v5.4*' 'v6*' | sed 's#.*refs/tags/##'); do | ||||||||||||||
| git merge-base --is-ancestor "$t" upstream/main || echo "$t" | ||||||||||||||
| done | ||||||||||||||
| ``` | ||||||||||||||
|
|
||||||||||||||
| Use upstream's tags, as above; a stale local tag gives a false report. | ||||||||||||||
|
Comment on lines
+61
to
+66
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The loop checks local tags despite the warning below it. Fetch upstream tags into a separate namespace and check those refs, or stop on fetch failure and explain how to resolve a tag mismatch. |
||||||||||||||
|
|
||||||||||||||
| ## Agent defaults | ||||||||||||||
|
|
||||||||||||||
| **Agent default:** | ||||||||||||||
|
|
||||||||||||||
| - Do not open a merge-forward PR unless a maintainer asks for that step; | ||||||||||||||
| release managers run them around patch releases. | ||||||||||||||
| - A backport is not finished when its PR merges. Report in the PR body | ||||||||||||||
| which merge-forward steps it still needs, using the commands above. | ||||||||||||||
| - Resolve a merge-forward conflict by taking the maintenance side only when | ||||||||||||||
| `main` lacks the change; state the reason for each conflict. | ||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
During
release-X.X→release,mainis not the destination and can contain newer development that must stay out ofrelease. Comparing that result withupstream/mainalso shows legitimate development differences, not just resolution errors. The contributing guide repeats this guidance.Use
release's form and compare againstupstream/releasefor the first step. Reserve the current guidance forrelease→main.