I am aware that we can undo like this : How do I undo the most recent local commits in Git?
However if the commit we want to undo is the first one in the project we got this error message:
git add file
git commit -m "first commit"
git reset HEAD~1
fatal: ambiguous argument 'HEAD~1': unknown revision or path not in the working tree.