Git和硬链接 [英] Git and hard links

查看:415
本文介绍了Git和硬链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

考虑到Git不能识别指向仓库之外的符号链接,使用硬链接有什么问题吗?

Git可以打破它们吗?
您能指点我详细的信息吗?

解决方案

表示Git中目录的'tree'文件名和(子集)权限。它不存储inode号码(或其他类型的文件ID)。因此硬链接 不能用git来表示,至少不能没有第三方工具,如 metastore git-cache-meta (我不确定是否可以使用这些工具)。



Git尝试不接触不需要更新的文件,但是您有考虑到git并不试图保留硬链接,所以它们可以被git破坏。




关于<指向仓库之外的符号链接:git与它们没有问题,应该保留符号链接的内容......但这些链接的实用性对我来说是可疑的,因为这些符号链接是否会被破坏取决于文件系统布局 外部 git存储库,并且不受git控制。


Considering that Git does not recognize symbolic links that point outside of the repository, is there any problem using hard links?

Could Git break them? Can you please point me to detailed information?

解决方案

The 'tree' object, representing directories in Git, stores file name and (subset of) permissions. It doesn't store inode number (or other kind of file id). Therefore hard links cannot be represented in git, at least not without third party tools such as metastore or git-cache-meta (and I am not sure if it is possible even with those tools).

Git tries to not touch files that it doesn't need to update, but you have to take into account that git doesn't try to preserve hardlinks, so they can be broken by git.


About symbolic links pointing outside repository: git has no problems with them and should preserve contents of symbolic links... but utility of such links is dubious to me, as whether those symlinks would be broken or not depends on the filesystem layout outside git repository, and not under control of git.

这篇关于Git和硬链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆