Git version fallback there are two cases, one is from the local repository (head area) fallback to a version, you can use the command git reset--hard head^ or git reset--hard head~x, head refers to the current version, head^ Refers to a fallback to the previous version, Head~x,x is any number greater than 0, indicating fallback to the previous X versions of the current version. (If you go back to a version from the latest repository and back to the latest repository, you can use the git reflog command to find the ID of each operation, and then use the command git reset--hard ID can go back to the corresponding version)
The second case is to fall back from staging area to the workspace, such as I added filename.txt this file to staging area git add filename.txt, and then I don't want to save it to staging area, you can use the command git reset head Filename.txt, so that when we execute the commit command, the Filename.txt file is not committed to the local repository.
Version fallback in Git