Restore the specified file in the staging area to the workspace $ git checkout [file]
Restore the specified files of a commit to the staging area and workspace $ git checkout [commit] [file] Restore all files in the staging area to the workspace $ git checkout . Reset the specified files in the staging area , consistent with the last commit, but the workspace remains unchanged $ git reset [file] Reset the staging area and workspace, consistent with the last commit $ git reset --hard Reset the pointer of the current branch For the specified commit, reset the staging area at the same time, but the work area remains unchanged $ git reset [commit] Reset the HEAD of the current branch to the specified commit, and reset the staging area and work area at the same time, consistent with the specified commit $ git reset --hard [commit] Reset the current HEAD to the specified commit, but keep the staging area and workspace unchanged $ git reset --keep [commit] Create a new commit to undo the specified commit The latter All changes will be offset by the former and applied to the current branch $ git revert [commit] Temporarily remove uncommitted changes and move them in later $ git stash $ git stash pop
git checkout -f
Clear all modifications without add in the current directory.
Restore the specified file in the staging area to the workspace
$ git checkout [file]
Restore the specified files of a commit to the staging area and workspace
$ git checkout [commit] [file]
Restore all files in the staging area to the workspace
$ git checkout .
Reset the specified files in the staging area , consistent with the last commit, but the workspace remains unchanged
$ git reset [file]
Reset the staging area and workspace, consistent with the last commit
$ git reset --hard
Reset the pointer of the current branch For the specified commit, reset the staging area at the same time, but the work area remains unchanged
$ git reset [commit]
Reset the HEAD of the current branch to the specified commit, and reset the staging area and work area at the same time, consistent with the specified commit
$ git reset --hard [commit]
Reset the current HEAD to the specified commit, but keep the staging area and workspace unchanged
$ git reset --keep [commit]
Create a new commit to undo the specified commit
The latter All changes will be offset by the former and applied to the current branch
$ git revert [commit]
Temporarily remove uncommitted changes and move them in later
$ git stash
$ git stash pop
git checkout --directory name, delete changes in a certain directory