15.从分支中删除提交
创建一个新提交,并打上标签
# 查看文件内容
$ cat .\test.txt
abc
oops
# 提交到版本库
$ git commit -a -m "Oops,an error committed"
# 查看提交日志
$ git hist
* 739560c 2023-05-05 | Oops,an error committed (HEAD -> master) [aku]
* 1ca1854 2023-05-05 | Revert "Added 123 to the test.txt" [aku]
* 375f4fe 2023-05-05 | Added 123 to the test.txt [aku]
* d7f681f 2023-05-05 | Added abc to the test.txt (tag: v1) [aku]
* 01b8702 2023-05-05 | Add first file (tag: v1-beta) [aku]
# 打上标签 oops
git tag oops
$ cat .\test.txt
abc
oops恢复提交之前的文件
记录其实还在,并且我们还可以引用
Last updated