- Prefer
gh pr checkout <number> --detachfor review-only work so disposable local branches do not accumulate. - If a separate worktree is useful, give it an obviously temporary name and remove it with
git worktree remove <path>when the review is done. - After temp worktrees are removed or deleted out-of-band, run
git worktree prune -vto clear stale metadata. - Before starting substantial new work, prefer returning the root repo to a clean, current baseline with
git status --short --branch,git fetch --prune origin,git checkout main, andgit pull --ff-only origin mainwhen that fits the repo workflow. - Ask before deleting unmerged branches.
- Clean up disposable review branches like
pr-<number>and*-reviewonce they are merged or no longer needed.
Created
March 24, 2026 19:40
-
-
Save mikehostetler/940e5363283390bfa223e5ad153a8220 to your computer and use it in GitHub Desktop.
Codex Worktree Cleanup Hack
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| developer_instructions = """ | |
| Prefer detached PR checkouts for review-only work. | |
| Ask before deleting unmerged branches. | |
| """ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment