@@ -348,13 +348,21 @@ their branch into logical commits (preferred), maintainers should use the
348348* Squash and merge* button on the pull request to consolidate patches into
349349logical commits.
350350
351- For bug fixes that are ready to be included in the next patch release, make a
352- comment on the pull request which states the topic should be merged to the
353- ` release ` and ` release-X.X ` maintenance branch, where ` X.X ` are the current
354- maintenance version, e.g. ` 5.4 ` .
351+ ### Merge a bug fix for a patch release
355352
356- Here are the recommended steps to merge a topic to both ` release ` and ` main `
357- branches, assuming the topic branch is forked off the ` release ` branch:
353+ For bug fixes that need to be included in a patch release, follow these steps
354+ to merge the topic into the ` release ` , ` release-X.X ` , and ` main ` branches,
355+ where ` X.X ` is the maintenance version targeted by the fix (e.g., ` 5.4 ` ).
356+
357+ 1 . Branch the topic appropriately:
358+
359+ - If the patch applies to the ** upcoming patch of the most recent release** ,
360+ fork the topic off ` release ` .
361+ - If the patch applies to an ** older maintenance series** (e.g., ITK 5),
362+ fork the topic off ` release-5.4 ` (or the corresponding ` release-X.X `
363+ branch). Open the pull request against that same ` release-X.X ` branch.
364+
365+ 2 . Merge the topic into the ` release-X.X ` branch:
358366
359367``` bash
360368git checkout release-X.X
@@ -363,7 +371,7 @@ git merge --no-ff my-topic
363371git push upstream release-X.X
364372```
365373
366- then :
374+ 3 . Merge the ` release-X.X ` branch into the ` release ` branch :
367375
368376``` bash
369377git checkout release
@@ -372,7 +380,7 @@ git merge --no-ff release-X.X
372380git push upstream release
373381```
374382
375- then :
383+ 4 . Finally, merge the ` release ` branch back into the ` main ` branch :
376384
377385``` bash
378386git checkout main
@@ -381,7 +389,11 @@ git merge --no-ff release
381389git push upstream main
382390```
383391
384- to merge the ` release ` branch back to ` main ` .
392+ This ensures the bug fix is included in the patch release and the ` main `
393+ development branch, and that ` release-X.X ` , ` release ` , and ` main ` all stay
394+ connected in the Git history (the directed acyclic graph that records branch
395+ ancestry). Keeping the branches connected also avoids future merge conflicts
396+ between the maintenance and development lines.
385397
386398(delete-a-topic)=
387399Delete a Topic
0 commit comments