10.切换版本
解释
实验
# 查看提交日志
$ git hist
* d7f681f 2023-05-05 | Added abc to the test.txt (HEAD -> master) [aku]
* 01b8702 2023-05-05 | Add first file [aku]
# 查看文件内容
$ cat .\test.txt
abcLast updated
# 查看提交日志
$ git hist
* d7f681f 2023-05-05 | Added abc to the test.txt (HEAD -> master) [aku]
* 01b8702 2023-05-05 | Add first file [aku]
# 查看文件内容
$ cat .\test.txt
abcLast updated
# 切换指定版本
$ git checkout 01b8702
Note: switching to '01b8702'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:
git switch -c <new-branch-name>
Or undo this operation with:
git switch -
Turn off this advice by setting config variable advice.detachedHead to false
HEAD is now at 01b8702 Add first file
$ cat .\test.txt