79752182

Date: 2025-09-01 05:26:04
Score: 1
Natty:
Report link

When the files are only staged and you want to unstage, just use git reset for that as @neuroine answered:

git reset /path/to/file

But if you created just one commit but now want to soft reset. Using git reset --soft won't work as it will say:

$ git reset --soft HEAD~
fatal: ambiguous argument 'HEAD~': unknown
revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

In that case, we can use update-ref:

git update-ref -d HEAD

Keeping this extra detail here even though it was not directly asked in the question because it is a similar problem and people can stumble upon this and find solution here.

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • User mentioned (1): @neuroine
  • Self-answer (0.5):
  • Starts with a question (0.5): When the
Posted by: Meraj al Maksud