跳到主要内容
知仓学习社ZHICANG

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 cur…

不碰外部(只输出文字)无严重或高危命中cbrock84/headcount

它会碰到什么

扫了多少1 个文本文件,2 KB
它会碰到什么不碰外部(只输出文字)
命中总数0 处
命中统计严重 0 · 高 0 · 中 0 · 低 0

这一栏是扫描器报的事实,不是结论。命中多不等于有毒(安全工具、规则库、示例脚本本来就会包含危险写法),命中少也不等于干净。它和你手上的凭据、文件、网络有什么关系,需要你自己看。

技能内容

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.

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.

想直接用这个技能?

本站把开放许可(MIT / Apache 等)的技能按仓库打包整理到网盘,点一下转存到你自己的网盘,不用一个个从 GitHub 拉。许可未声明的技能只给原始仓库链接,不打包。