|
| 1 | +# Branching And Merge Rules |
| 2 | + |
| 3 | +This repository uses a strict `main` / `develop` / feature-branch workflow. Follow these rules whenever you perform merges, release preparation, or branch synchronization. |
| 4 | + |
| 5 | +## Core Policy |
| 6 | + |
| 7 | +- Do not develop directly on `main` or `develop`. |
| 8 | +- End every release or merge workflow back on a feature branch, not on `main` or `develop`. |
| 9 | +- Use merge commits, not fast-forward merges, for both feature integration and release promotion. |
| 10 | + |
| 11 | +## Feature Branch To `develop` |
| 12 | + |
| 13 | +- Merge feature branches into `develop` with `git merge --no-ff`. |
| 14 | +- Keep the merge commit explicit. |
| 15 | +- After the merge completes, rebase the merged feature branch so it stays synchronized with the updated `develop`. |
| 16 | + |
| 17 | +## `develop` To `main` |
| 18 | + |
| 19 | +- Only merge `develop` into `main` when intentionally releasing a new version. |
| 20 | +- Merge `develop` into `main` with `git merge --no-ff`. |
| 21 | +- Before merging `develop` into `main`, explicitly ask the user to confirm: |
| 22 | + - the release version number to publish now |
| 23 | + - the next development version number after release |
| 24 | +- The usual version progression is to increment the trailing component by 1, for example `v0.1.22 -> v0.1.23`, but you must still ask the user to confirm. |
| 25 | +- Before merging `develop` into `main`, check whether `changes.log` already contains the release notes for the pending release. |
| 26 | +- If `changes.log` is missing the release notes, summarize them from the relevant git commit history and prepare a `changes.log` update on `develop`. |
| 27 | +- Before committing that `changes.log` update on `develop`, ask the user to confirm that the proposed release-note content is appropriate. |
| 28 | +- After the merge commit is created on `main`, immediately create a version tag in the form `vx.x.x`. |
| 29 | + |
| 30 | +## Post-Release Version Bump |
| 31 | + |
| 32 | +After tagging the release on `main`: |
| 33 | + |
| 34 | +1. Switch to `develop`. |
| 35 | +2. Rebase `develop`. |
| 36 | +3. Run `npm run setver x.x.x`. |
| 37 | +4. Run `npm i`. |
| 38 | +5. Commit the version bump immediately with: |
| 39 | + - `chore: update to version vx.x.x` |
| 40 | + |
| 41 | +## Final Branch State |
| 42 | + |
| 43 | +After the post-release version bump commit on `develop`: |
| 44 | + |
| 45 | +1. Switch back to the active feature branch. |
| 46 | +2. Rebase that feature branch. |
| 47 | +3. Confirm the working branch is the feature branch before continuing development. |
| 48 | + |
| 49 | +## Practical Constraints For AI Agents |
| 50 | + |
| 51 | +- Never leave the repository on `main` after a release workflow. |
| 52 | +- Never leave the repository on `develop` after a release workflow unless the user explicitly says to stop there. |
| 53 | +- If a task involves merges or releases, read this file first and follow it exactly. |
| 54 | +- Do not guess release version numbers without explicit user confirmation. |
| 55 | +- Do not merge `develop` into `main` until both version confirmation and `changes.log` confirmation have been completed with the user. |
0 commit comments