Suppose plan.txt is tracked, a change has been staged, and another edit has been made afterward. The index holds the staged version; the working file holds the later version. Inspect both differences first:
git status
git diff -- plan.txt
git diff --staged -- plan.txt
To take this file out of the next commit while keeping its working contents, in a repository with an existing HEAD commit:
git restore --staged -- plan.txt
The index entry now matches HEAD; the working file is unchanged. The combined difference may now appear unstaged. If plan.txt was a newly staged file absent from HEAD, it becomes untracked; its working file remains. On a new branch with no first commit, there is no HEAD for this command’s default source.
To discard the unstaged edits instead, the following replaces the working file with its index version. It does not unstage it:
Destructive: Run only in a disposable repository, or after inspecting the exact path and making an independent backup of any wanted edits. Unstaged content Git never recorded may be unrecoverable.
git restore --worktree -- plan.txt
-- separates options from the path, including a name beginning with -. Recheck git status and both diffs afterward. Restore affects the named path rather than moving a branch; it is not a way to remove an already recorded commit. It does not ordinarily remove an untracked file that has no index entry.