diff --git a/Docs/Engine/GitPolicy.md b/Docs/Engine/GitPolicy.md index 6d029e2..8100cda 100644 --- a/Docs/Engine/GitPolicy.md +++ b/Docs/Engine/GitPolicy.md @@ -60,35 +60,87 @@ Version numbers **must not** appear in commit messages. ## 3. Branches -The project allows the following branch types: +| Branch | What it is | How code gets in | +|---|---|---| +| `master` | what is released | a pull request from `develop` | +| `develop` | active development and integration | a pull request from a work branch | +| `feature/*` | one task | commits | +| `experiment/*` | temporary or high-risk research work | commits | -* `main` — stable integration branch -* `develop` — active development and integration -* `feature/*` — development of specific systems or technologies -* `experiment/*` — temporary or high-risk research work +`master` and `develop` take pull requests only: nobody pushes there, the owner included. A work branch may be rewritten +or abandoned; once merged it is deleted. -Branches may be: +--- -* deleted without preservation -* rewritten -* abandoned +## 4. The way of a change -This is expected and acceptable. +The same in the core, in a module and in a tool. Each is a repository of its own: run the commands in its folder. ---- +### 4.1 Every day -## 4. Merging +```powershell +# 1. A branch, from a fresh develop +git switch develop +git pull --ff-only +git switch -c feature/ -Before merging into `main`: +# 2. Commits, small ones. The hooks check the marks +git add . +git commit -m "[TAG] " -* the code must build -* changes must be logically complete -* commit history must remain readable +# 3. A pull request into develop +git push -u origin HEAD +gh pr create -B develop --fill -Versions (Git tags) are **created only on `main`**. +# 4. Merged once everything is green +gh pr checks --watch +gh pr merge --merge --delete-branch ---- +# 5. Back to develop +git switch develop +git pull --ff-only +``` + +More commits on the same task before the merge: `git commit` and `git push`, the pull request takes them by itself. + +Always a **merge commit**, never a squash or a rebase: those make other commits out of the same changes, and `develop` +and `master` drift apart. + +### 4.2 A change of several repositories + +The one the others use goes first: the core, then the modules. At a release it is the other way round (4.3). + +### 4.3 A release +A snapshot of the mirror takes `master` of every component, so the core goes last: + +1. each module that changed: a pull request from `develop` into `master`, merged; +2. the core: the new versions in `Shared/Build/Stellar.Versions.props` through a usual pull request into `develop`; +3. the core: a pull request from `develop` into `master`. **Its merge releases the version**; +4. the mirror: Run workflow of *Mirror* in StellarEngine-Mono, unless the release started it. + +```powershell +gh pr create -B master -H develop -t " " -b "" +gh pr checks develop --watch +gh pr merge develop --merge +``` + +`develop` is not deleted, and `master` is never merged back by hand. + +### 4.4 When something is in the way + +| What you see | What to do | +|---|---| +| the commit is stopped by a mark | `stellar marks list`, look at the place, take the mark out or leave the file out of the commit | +| `push` says *protected branch* | you are on `develop` or `master`: `git switch -c feature/` and push that; the commits come with you | +| the pull request says *out of date* or *conflicts* | `git fetch origin`, `git merge origin/develop` in the work branch, solve, commit, push | +| a check is red | open it, fix in the same branch, push | +| `pull --ff-only` refuses | there are commits on `develop` that are not on the server: `git switch -c feature/`, then `git branch -f develop origin/develop` | + +Before merging into `master` the code must build, changes must be logically complete, and the history must remain +readable. Versions (Git tags) are **created only on `master`**. + +--- ## 5. Git Tags ### 5.1 Version Tags