task-observer: docs/ai/git updates from 2026-05-08#12
Conversation
Before creating a new worktree to recover from accidental main-checkout work, check whether a clean existing worktree can be reused instead. Minimises workspace sprawl and abandoned branches.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4dd72d6a66
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| git -C <worktree-path> fetch origin <target> | ||
| git -C <worktree-path> checkout <target> |
There was a problem hiding this comment.
Fast-forward the branch before recovery
Step 2 says to “Fast-forward” the existing worktree branch, but the documented commands do not do that: git fetch origin <target> only updates fetched refs/FETCH_HEAD, and git checkout <target> just switches HEAD to a branch (git checkout -h: usage: git checkout [<options>] <branch>). In a common case where local <target> is behind origin/<target>, this leaves the worktree on a stale tip and can cause cherry-picks to be replayed onto the wrong base.
Useful? React with 👍 / 👎.
Target
global-doc: docs/ai/git.md
Observations addressed
Generated by Claude Code