To loose the unstaged changes to a file (i.e. reverting to the committed changes) while using git:
It will not loose another unstaged or staged changes.
To show a log of commits:
To show detailed log:
To see the detailed log about a particular file:
To see a file at a specific commit, we have to first check the commit-id or hash using the git log commands explained above. You may copy a first few characters of a commit-id. The syntax for this is:
This will show the file at that specific commit. You can also direct its output to a new file using the ‘>’ operator.
And to show all changes at that particular commit:
So to revert to all changes at a commit state:
To revert one file to a particular commit: