In the .git/objects/
folder there are many folders with files within such as ab/cde...
. I understand that these are actually blobs abcde...
Is there a way to obtain a flat file listing of all blobs under .git/objects/
with no /
being used a delimitor between ab
and cde
in the example above? For e.g.
abcde....
ab812....
74axs...
I tried
/.git/objects$ du -a .
This does list recursively all folders and files within the /objects/
folder but the blobs are not listed since the command lists the folder followed by the filename (as the OS recognizes them, as opposed to git). Furthermore, the du
command does not provide a flat listing in a single column -- it provides the output in two columns with a numeric entry (disk usage) in the first column.
2条答案
按热度按时间kq0g1dla1#
我认为你应该从这里开始(git version 2.37.2):
这样做的好处是,不仅可以检查 * unpacked * 对象所在的目录,还可以检查已经打包的对象(不再位于该目录中)。
vlju58qv2#
如果您在.git/objects/文件夹中
试试这个
find . -type f | sed -e 's/.git\/objects\///' | sed -e 's/\///'
sed -e
需要sed脚本,这意味着查找/替换模式。's/.git\/objects\///'
找到.git/objects/
,并将其替换为''
,''
是空的。因此,sed
命令删除模式。模式中的
\
是转义字符。第一个sed命令结束后,结果将是(在linux中)。
要删除引用目录标志的
/
,sed -e 's/\///'
如果您在包含
.git
的目录中find .git/objects/ -type f | sed -e 's/.git\/objects\///' | sed -e 's/\///'
试试这个。