Unstaging and discarding
Two very different undos that people reach for interchangeably.
Unstaging copies from HEAD back into the index, leaving your file alone. Discarding copies from the index into your file, destroying what you had written. The first is always safe; the second is one of the few commands in git that can genuinely lose work.
`git restore --staged <file>` unstages. `git restore <file>` discards. The similarity is unfortunate and worth learning deliberately, once.
Nothing that has been committed is at risk from either. It is only the uncommitted middle ground that a discard can take from you.
Commands in this lesson
git restore- Copy a file back from the index, or with --staged from HEAD into the index