Restore selected paths into both destinations
When a task requires the index and worktree to match a specified commit, use:
git restore --source=<commit> --staged --worktree -- <path>
Replace the placeholders with the commit and path specified by the task. An explicit source matters: the index and HEAD can contain different versions. Both destination flags are needed to change both destinations.
This path-scoped operation does not move HEAD or branch references. Avoid reset, checkout of a branch, commits, clean, or broad path selections, which can alter unrelated state. Inspect the target and unrelated state without making additional changes.