Overview
Git reset --hard discards uncommitted modifications. It should be used only when losing those changes is intentional.
Git rm -f also discards local modifications in the removed file.
Git restore replaces uncommitted work with the last committed version. That is useful for abandoning a failed approach, but inappropriate when the work still needs to be preserved.
Reset can make commits disappear from the visible branch history. Revert is more traceable because it records the correction as a new commit.
Git rm --cached does not delete the local file. It changes tracking state, so the file then appears as untracked.