如何在 Git LFS 中查看指针文件的内容?
我有一个 Git LFS 存储库,并且在本地我已经提取了所有 LFS 文件。我想检查 LFS 使用的“指针”文件,但我只能看到实际的 LFS 二进制文件。
我在哪里/如何明确地看到 git 中的指针文件,而不是它们指向的二进制文件?
I have a Git LFS repo and locally I've already pulled all the LFS files. I would like to inspect the 'pointer' files LFS uses, but all I can see are the actual LFS binary files.
Where/how can I explicitly see the pointer files in git, rather than the binary files they point to?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
简短回答
您可以通过以下方式查看指针文件的内容:
更多详细信息
规格非常清晰而且很小。我不知道所有细节,但我的理解如下:
使用 git-lfs 时,它会创建(除其他外)一个文件夹
.git/lfs
,其中将下载大量文件(可以可以在$ git lfs env
的输出中看到。这些文件不会与 git 历史记录一起保存,而是单独保存(例如在 https://git-lfs.github.com 中) )。什么 git 版本是指向这些文件的指针,如下所示:这是我的存储库中文件的指针的内容(例如
path/to/myfile.a
),我将其使用以下命令显示:请注意,
path/to/myfile.a
是相对于存储库的根目录的。从上面的
oid
中,我们可以找到git-lfs下载的文件到.git/lfs
,就我而言,它在这里:现在,如果您只是
git clone
您的存储库并安装了 git-lfs,您将在处获得完整文件路径/to/myfile.a
。但在没有 LFS 的情况下实际克隆存储库很有趣:您将看到现在
myfile.a
是指针文件!Short answer
You can see the content of the pointer file with:
More details
The specs are pretty clear and quite small. I don't know all the details, but my understanding is the following:
When using git-lfs, it creates (among others) a folder
.git/lfs
where the heavy files will be downloaded (can be seen in the output of$ git lfs env
). Those files are not saved with the git history, but separately (e.g. in https://git-lfs.github.com). What git versions is pointers to those files, which look like the following:This is the content of a pointer in my repo, for a file (say
path/to/myfile.a
), and which I showed with the following command:Note that
path/to/myfile.a
is relative to the root of the repository.From the
oid
above, we can find the file that was downloaded by git-lfs into.git/lfs
, in my case it's here:Now if you just
git clone
your repo and have git-lfs installed, you will have the full file atpath/to/myfile.a
. But it's interesting to actually clone the repo without LFS:And you will see that now
myfile.a
is the pointer file!您需要在本地执行“git lfs pull”,然后才能看到lfs文件内容。
You need to "git lfs pull" in your local, then you can see the lfs file content.
您需要运行:
来配置存储库以处理 lfs 文件。
使用后:
提取 lfs 文件的内容。
注意:以后,运行 git lfs install 一次后,LFS 文件将自动下拉。
但每当您遇到只看到的问题时:
您可以使用 git lfs pull 来获取文件的内容。
You need to run:
to configure the repository to handle lfs files.
there after use:
to pull the content of the lfs-files.
NOTE: In the future, LFS files will be pulled down automatically after you've run git lfs install once.
but whenever you get the problem where you see only:
you can use the
git lfs pull
to get the content of the file.