Hi I can do hard reset of a file whose changes have not been staged and is currently in working directory by
git checkout HEAD -- my-file.txt
as mentioned here Hard reset of a single file.
But my question is how to reset a single file to the previous head not all other files when it is commited and also if it is pushed in the remote.