GIT_AUTHOR_NAME=b1f6c1c4\GIT_AUTHOR_EMAIL=b1f6c1c4@gmail.com \GIT_AUTHOR_DATE='1600000000 +0800' \GIT_COMMITTER_NAME=b1f6c1c4 \GIT_COMMITTER_EMAIL=b1f6c1c4@gmail.com \GIT_COMMITTER_DATE='1600000000 +0800' \git commit-tree5841-pd4da<<EOFMessage may be readfrom stdinor by the option '-m'EOF# efd4f82f6151bd20b167794bc57c66bbf82ce7dd
gitcat-filecommitefd4# tree 58417991a0e30203e7e9b938f62a9a6f9ce10a9a# parent d4dafde7cd9248ef94c0400983d51122099d312a# author b1f6c1c4 <b1f6c1c4@gmail.com> 1600000000 +0800# committer b1f6c1c4 <b1f6c1c4@gmail.com> 1600000000 +0800## Message may be read# from stdin# or by the option '-m'
Lv3
使用git show直接作用在commit上可以看到commit本身及其tree的diff情况
gitshowefd4~# commit d4dafde7cd9248ef94c0400983d51122099d312a# Author: b1f6c1c4 <b1f6c1c4@gmail.com># Date: Mon Jan 1 00:00:00 2018 +0800## The commit message# May have multiple# lines!## diff --git a/name.ext b/name.ext# new file mode 100644# index 0000000..ce01362# --- /dev/null# +++ b/name.ext# @@ -0,0 +1 @@# +hello# diff --git a/name2.ext b/name2.ext# new file mode 100755# index 0000000..ce01362# --- /dev/null# +++ b/name2.ext# @@ -0,0 +1 @@# +hello
特别注意:git tag -a命令不仅仅创建了tag对象,还建立了新的引用在refs/tags/the-tag。
# 该命令没有输出GIT_COMMITTER_NAME=b1f6c1c4\GIT_COMMITTER_EMAIL=b1f6c1c4@gmail.com \GIT_COMMITTER_DATE='1600000000 +0800' \git tag-a-m'The tag message'the-tagefd4:name.ext# 需要用如下命令找到新创建的对象gitrev-parsethe-tag# 9cb6a0ecbdc1259e0a88fa2d8ac4725195b4964d
查看tag
Lv0 模仿commit的查看方法即可
Lv2
gitcat-filetag9cb6# object ce013625030ba8dba906f756967f9e9ca394464a# type blob# tag the-tag# tagger b1f6c1c4 <b1f6c1c4@gmail.com> 1600000000 +0800## The tag message# 注意:如果想要查看tag指向的对象,只需要修改type即可:gitcat-fileblob9cb6# hello
Lv3
# 注意:git show同时显示tag本身和tag指向的对象的信息gitshow9cb6# tag the-tag# Tagger: b1f6c1c4 <b1f6c1c4@gmail.com># Date: Sun Sep 13 20:26:40 2020 +0800## The tag message# hello
检查文件系统
查找并删除无用对象:(有一定危险,可能会删掉有用的东西)
Lv2
(gitupdate-refHEADefd4)gitcount-objects# 6 objects, 24 kilobytes# 列出没有在任何引用中使用的对象gitfsck--unreachable# unreachable tag aba3692b60790d098d3f6682555214f3bf09f7da# 列出没有在任何引用或对象中使用的对象gitfsck# dangling tag aba3692b60790d098d3f6682555214f3bf09f7da# 删除以上(**有一定危险,可能会删掉有用的东西**)gitprunegitcount-objects# 5 objects, 20 kilobytesgitfsck--unreachablegitfsck
检查文件系统完整性:
Lv2
mvobjects/ce/013625030ba8dba906f756967f9e9ca394464a../evilgitfsck--connectivity-only# broken link from tag 9cb6a0ecbdc1259e0a88fa2d8ac4725195b4964d# to blob ce013625030ba8dba906f756967f9e9ca394464a# missing blob ce013625030ba8dba906f756967f9e9ca394464amv../evilobjects/ce/013625030ba8dba906f756967f9e9ca394464agitfsck--connectivity-only
(gitreplace--deleteefd4>/dev/null)gitreplace-fefd49f31gitreplace-f9f31efd4gitcat-filecommitefd4# fatal: replace depth too high for object efd4f82f6151bd20b167794bc57c66bbf82ce7dd(gitreplace--delete9f31>/dev/null)
gitcat-filecommitefd4# tree 58417991a0e30203e7e9b938f62a9a6f9ce10a9a# parent d4dafde7cd9248ef94c0400983d51122099d312a# author Mx. Evil <evil@gmail.com> 1600000000 -0400# committer Mx. Evil <evil@gmail.com> 1600000000 -0400## OOF.. This is a fake one... hahahaha!# 注意--no-replace-objects是总的参数,不是cat-file自己的git--no-replace-objectscat-filecommitefd4# tree 58417991a0e30203e7e9b938f62a9a6f9ce10a9a# parent d4dafde7cd9248ef94c0400983d51122099d312a# author b1f6c1c4 <b1f6c1c4@gmail.com> 1600000000 +0800# committer b1f6c1c4 <b1f6c1c4@gmail.com> 1600000000 +0800## Message may be read# from stdin# or by the option '-m'
Lv3
gitshowefd4# commit efd4f82f6151bd20b167794bc57c66bbf82ce7dd# Author: Mx. Evil <evil@gmail.com># Date: Sun Sep 13 08:26:40 2020 -0400## OOF.. This is a fake one... hahahaha!git--no-replace-objectsshowefd4# commit efd4f82f6151bd20b167794bc57c66bbf82ce7dd# Author: b1f6c1c4 <b1f6c1c4@gmail.com># Date: Sun Sep 13 20:26:40 2020 +0800## Message may be read# from stdin# or by the option '-m'
gitnoteslist# c5a9a385e3dbe4e65d6db1957bfe18dbf85c517c ce013625030ba8dba906f756967f9e9ca394464a# 095f841daf9333f3addfbc44d49efab0be903bfe efd4f82f6151bd20b167794bc57c66bbf82ce7ddgitnotesshowefd4# additional notesgitnotesshowce01# notes for blobgitshowefd4# commit efd4f82f6151bd20b167794bc57c66bbf82ce7dd# Author: b1f6c1c4 <b1f6c1c4@gmail.com># Date: Sun Sep 13 20:26:40 2020 +0800## Message may be read# from stdin# or by the option '-m'## Notes:# additional notes