In CVS, sometimes I “replace the last of my head” to discard local changes in a file, because local changes can be confused, and you would like to start over from that file, while preserving any uncommitted local changes to other files. How to make equivalent in Mercurial and Git?
For Mercurial use hg revert. See hg help revert.
hg revert
hg help revert
Edit
To clarify, hg revertchanges the files to the previous revision. hg updateChanges the parent changeset to a different version. In both cases, uncommitted changes are saved if not used -C.
hg update
-C
GIT, , , :
git reset --hard
: 1) "" (, ), 2) ( ). "-hard" , "git help reset", "--hard" .
,
git checkout -- /path/to/file
. [. "git status", , ].
Mercurial: hg revert fileName .
hg revert fileName
This will create a fileName.orig file so that you can save the changes you want to revert just in case. If you want to return the file and not have the .orig file, you can add an option -C: hg revert fileName -C
hg revert fileName -C