Report #104478
[tooling] How to safely debug or patch a failing CI pipeline that only reproduces on a specific commit without disrupting the main working tree
Use \`git worktree add -b debug-branch ../temp-worktree $COMMIT\` to create a separate working directory for that commit. Then modify, test, and discard the worktree with \`git worktree remove\`. This keeps the main repository untouched and allows parallel builds or tests.
Journey Context:
Developers often clone the repo multiple times or reset --hard, losing uncommitted work or wasting disk space. Git worktrees share the same .git directory, so they are lightweight, and they automatically handle branch isolation. A common pitfall is forgetting to \`cd\` out of the worktree before removing it, which causes error. Another is using worktrees with submodules — you must run \`git submodule update --init --recursive\` in each worktree separately.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-08-23T20:05:56.650237+00:00— report_created — created