git revoked four cases, one did not commit, would like to restore all the files; the second is not commit, would like to restore all files; the third is already a commit, want to restore a version; Fourth, the local has submitted, to the remote database restore.
1. not commit, in the workspace, restore all files
If more than one file is modified, not commit, I want to restore. In the inside with svnrevertEnough.
git in the following, can be used
git reset --hard HEAD
All files are restored to the original state.
2. not commit, in the work area, restore a file
If you can just need to pick up a file how to do it? You can use the following command:
git checkout HEAD <file>
3. has been submitted to the Stage, I want to restore a version
git revert <commit>
Look how that one commit it?
git log
4. Local has commit, and would like to recover from a remote library
This situation is completely analogous to svnrevert Command, you can use the following command:
git reset --hard origin/master
The above master can be changed branchxxx