← LeaderboardThe Skill Leaderboard

branch-and-worktree-workflow

Isolates feature work in its own branch or worktree and integrates it cleanly when done. Use this when starting work that should not disturb the current workspace, when several efforts must proceed in parallel on one repository, or when implementation is finished and the change needs merging, rebasing, or splitting for review.

Published by cbrock84 ↗cbrock84/headcount

Try your first task

A source-grounded starter task has not been verified for this skill yet.

SKILL.md

name: branch-and-worktree-workflowdescription: Isolates feature work in its own branch or worktree and integrates it cleanly when done. Use this when starting work that should not disturb the current workspace, when several efforts must proceed in parallel on one repository, or when implementation is finished and the change needs merging, rebasing, or splitting for review.

Branch and worktree workflow

Starting

Work that will take more than one sitting, or that runs alongside other work, gets its own isolated workspace. A worktree gives you a second checkout of the same repository on a different branch — two efforts, two directories, one object store, no stashing.

Branch from the current upstream default, not from whatever is checked out. Branching off a stale local branch is how unrelated commits end up in a review.

While working

  • Commit at points where the tree is coherent, not at the end of the day.
  • Keep the branch current with its base often. A merge conflict found on day one is a five-minute fix; the same conflict found on day ten is an afternoon.
  • One concern per branch. If you find an unrelated bug, note it and leave it.

Finishing

Before proposing the work:

  1. Rerun the full check the project actually gates on, not the subset you have been running.
  2. Read your own diff top to bottom. Remove debug output, stray files, and commented-out code.
  3. Confirm the branch merges cleanly into its base.

Then decide how it integrates:

  • Small and coherent — merge as is.
  • Several separable concerns — split into stacked branches so each can be reviewed on its merits. A reviewer given three concerns in one diff reviews none of them well.
  • Exploratory — keep the useful commits, drop the rest.

Sources

references/sources.md in this skill lists the outside authorities that settle the questions here — what each one is authoritative for, and what you may do with it. Check them before answering on anything they cover, and cite what you used. Most are free to read and not free to reproduce; the use note on each is binding.

Never

  • Rewrite history on a branch someone else has checked out. Merge instead; a force-push breaks their working copy.
  • Leave a worktree behind after merging — stale worktrees hold references and confuse later work.
  • Merge your own change without the checks green on the final commit, not an earlier one.

Company context

Before answering, look for the company profile: the file .headcount/company.md in the working folder, or a document titled "Headcount company profile" in the conversation, the project's instructions or files, or saved memory. Where there is one, answer for that company and do not ask for anything it already states. Where it conflicts with what the person says now, the person is right, and say that the profile looks out of date. Where there is none, carry on: ask only for the facts this question turns on, and mention once that executive:company-onboarding records them so they are not asked again.

Other departments

A skill written as department:skill belongs to another department, and each department installs separately. If the one a question belongs to is not installed, name the department that owns it and how to add it, and do not improvise its work. references/departments.md in this skill lists each department this skill names, with the install step for Claude Code and for ChatGPT.

branch-and-worktree-workflow by cbrock84 · The Skill Leaderboard