Reset and checkout similarities and differences can achieve the same function, such as restoring local files, but reset more emphasis on "undo", such as revocation registers, undo registers and local, and checkout more emphasis on "replacement", such as the use of registers content to replace local, Use head to point directory to replace registers and local. Reset, undo git reset Head-filename
Undo the last staging (cancel registers content, replace the staging area with the directory (version library) pointed to by head) If you only delete staging and keep the workspace, you can use git rm--cached-r filename,-r to indicate that you want to delete the git reset--hard head:
Undo all changes to local and registers (the directory pointed to by Head (version Library) replaces local and registers) git Reset–hard origin/master
Undo local, registers, version libraries (replace local, registers, version libraries with origin/master of remote servers) checkout emphasis, replace
git checkout [--] filename
-Replaces the workspace file with the registers content. For example, working directory has changed, but want to discard these changes, then use git checkout--a.txt discard the changes to A.txt
git checkout head filename
-Replaces the registers and workspace file head with the directory (version library) pointed to by head
The head is often used in Git's commands to see the head as a pointer, a local version of the library, and a head that can be replaced with a remote library, for example, Origin/master,origin represents an address, and master is a branch. Origin
-Origin represents the address of the remote warehouse, in config file, as