# Git Restore Explicit Source Both Gold

> Restore selected paths from an explicit commit into both index and worktree while preserving HEAD, other paths and untracked files.

- Skill: `lily400/git-restore-explicit-source-both-gold` (Agent Skill)
- Install (CLI): `npx get-skill add lily400/git-restore-explicit-source-both-gold`
- Raw SKILL.md: https://api.skillmd.com/api/skills/lily400/git-restore-explicit-source-both-gold/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: lily400 (https://skillmd.com/u/lily400)
- Updated: 2026-11-22
- Page: https://skillmd.com/skills/lily400/git-restore-explicit-source-both-gold

---


# Restore selected paths into both destinations

When a task requires the index and worktree to match a specified commit, use:

```bash
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.

