Git and Worktree Workflow
This page defines the daily git standard for contributors and maintainers. Use it to start task worktrees, target pull requests, and clean up branches without mixing unrelated changes.
Branch roles
mainstays release-ready. Use it for release work and urgent hotfixes only.develis the default integration base for normal feature, fix, docs, and chore work.- Topic branches are short-lived and map to exactly one pull request.
- Release work is the main exception. Prepare it in a clean
mainworktree and follow Release Process.
Pull request targeting
- Start normal work from
develand open the PR back todevel. - Start hotfix work from
mainand open the PR back tomain. - After a hotfix lands on
main, sync it back intodevelbefore continuing normal development. - Do not open the same branch as separate PRs to both
develandmain. - Promote accumulated work to
mainthrough the release flow instead of reviewing the same change twice.
Branch naming
Use lowercase, hyphenated branch names that describe one concern. Prefer an issue identifier first when one exists.
feature/hs-123-segment-cachefix/hs-141-release-tag-cleanupdocs/git-workflowchore/dependency-check-tuninghotfix/0.0.13-npe-on-openrelease/0.0.13codex/segment-metrics-cleanupfor Codex-created branches when automation owns the branch
Worktree standard
- Treat the repository root as a control checkout. Keep it clean and use it for coordination, not long-running edits.
- Do active development in dedicated worktrees under a single sibling
directory such as
../worktrees. - Use one worktree per active task, one branch per worktree, and one PR per branch.
- Do not switch an existing task worktree to a different branch.
- Do not develop in a detached
HEADworktree. - Remove merged worktrees and delete merged local branches as soon as the PR is finished.
Recommended helper commands
The repository includes helper scripts:
scripts/git-worktree-start.shscripts/git-worktree-clean.sh
It also includes a reusable git alias snippet at
config/git/aliases.gitconfig.
Install the aliases once:
The helpers use ../worktrees by default. Override that location with
HESTIASTORE_WORKTREE_ROOT if you want a different parent directory.
Daily flows
Start a normal task from devel
This fetches the latest refs, creates feature/hs-123-segment-cache from
origin/devel, and creates a worktree at
../worktrees/feature-hs-123-segment-cache.
Start a hotfix from main
This creates hotfix/0.0.13-npe-on-open from origin/main.
Start a docs or chore task
Clean up after merge
The cleanup helper removes the matching worktree, prunes stale worktree
metadata, and deletes the local branch when it is already merged into main,
devel, origin/main, or origin/devel.
Rules that prevent merge noise
- Never start a new task by committing on whatever branch is currently open.
- Never mix unrelated fixes into an existing task branch because it is already checked out.
- If a second task appears while the first is in review, create a second worktree instead of rebasing both tasks together.
- If a task must change target from
develtomain, create a new hotfix branch frommainand cherry-pick the minimal commits instead of retargeting a large mixed branch. - Before opening the PR, verify that
git diff --stat origin/<target>...HEADshows only the intended concern.