Git must know which version the current version is. In Git, it is used to HEAD
indicate the current version. The previous version is HEAD^
the previous version HEAD^^
. Of course, it is easier to count 100 ^ in the previous 100 versions HEAD~100
.
Now, we want to roll back the current version "A" to the previous version "B", we can use the git reset command:
$ git reset --hard HEAD^ //HEAD is now at ea34578 B
Of course, you can also query the historical version (each commit will generate a version):
git log --pretty =oneline
Show all submitted version records, select id
Just execute git rest --hard id.