Skip to content

Git and GitHub Workflow

kurokyuu edited this page Nov 28, 2026 · 2 revisions

Git and GitHub workflow

Parallel branches, a change without a pull request, the check before a repository goes public, and CI.

Branches that run in parallel

Two open branches that each regenerate the same file — a delta appended to a schema file, a project inventory — conflict as soon as the first is merged. That is the cost of working in parallel, not a mistake, and it is handled in two places:

python3 Scripts/repo.py sync                  # merge the main branch into this one; on a conflict the merge stays
                                              # open, resolve the files, `commit --path`, or `sync --abort`
python3 Scripts/repo.py test-branch test/x a b --carry   # one branch carrying several, for one round of testing;
                                              # --carry builds it although untracked files lie about

sync merges rather than rebases, so nothing already pushed is rewritten, and it ignores files nobody has added. A test branch stays local and is thrown away with --recreate; a conflict resolved by hand on it is lost with it.

A change that skips the pull request

A change small enough that an issue and a PR are more overhead than the change is committed on a branch and then landed:

python3 Scripts/repo.py land                  # master fast-forwards to this branch, is pushed, the branch is deleted

It refuses a dirty tree, a branch with nothing master lacks, and a branch master has moved past (sync first). Fast-forward only: nothing is rewritten and nothing is merged behind your back.

The .devscripts submodule

A project others clone carries devscripts as a submodule (install.py --submodule). This machine runs ~/dev/tools/devscripts first, so the submodule ages without anything breaking locally - only a contributor or CI notices. On a branch:

python3 Scripts/repo.py devscripts            # .devscripts to the newest devscripts, staged; says how far it moved
python3 Scripts/repo.py commit --file msg.md

Before a repository goes public

python3 Scripts/repo.py leaks                 # gitleaks over the whole history and the working files

Both places, because a secret deleted from the tree is still readable in the history. The working files are the ones a commit would take - tracked and new, ignored ones left out - so build/, target/ and obj/ are not read. Secrets are redacted; one line per finding, exit 1 when there is one. Needs gitleaks (sudo dnf install gitleaks).

CI

repo.py ci is how a run is looked at — not three hand-built gh lines:

python3 Scripts/repo.py ci                    # the last runs of this branch, with durations
python3 Scripts/repo.py ci --watch            # wait for the run of the CURRENT COMMIT, then report
python3 Scripts/repo.py ci --timings          # seconds per step of the newest run, slowest first

--watch matches on the commit's sha rather than taking the newest run on record. A push takes a moment to appear, and watching whatever was already there reports the previous run as this one's result — which is how a red build reads as green. When the newest run is red, the failing steps are printed without asking.

--timings is the one to reach for when a pipeline feels slow, because the answer is usually dull and specific. Once it was two full builds of the same solution — a -warnaserror guard step ahead of verify, which then rebuilt everything with --no-incremental. 207 of 300 seconds. The guard belongs in dotnet.fatal_warnings instead, inside the build that was happening anyway.

Do not sit and watch a run. Push, carry on with something else, and check at the next natural pause. A run is minutes; the only reason to block on one is when the next step genuinely cannot start without its answer — a merge, usually. cancel-in-progress on a concurrency group means a second push kills the first run rather than leaving it to finish for nothing.

A hosted runner has no ~/dev/tools, so a project whose pipeline calls Scripts/dotnet.py needs the checkout as well. With the submodule that is one line, nothing else:

steps:
  - uses: actions/checkout@v4
    with:
      submodules: true

A project without the submodule checks this repository out in a second actions/checkout step (repository: Istarlabs/devscripts, path: .devscripts) and sets DEVSCRIPTS: ${{ github.workspace }}/.devscripts. Without either, every shim refuses and says so.

Clone this wiki locally