What file metadata is preserved by Git?

好久不见. 提交于 2020-01-02 07:12:11

问题


What file metadata is preserved by Git?

What is from ACL, owner, group ID, file permissions, atime, ctime, mtime preserved in Git history?

As I know there is special handling for executable permission:

git add --chmod=+x one.txt
git add --chmod=-x two.txt

Is anything else preserved by Git?


回答1:


Virtually none.

Git will look at the x bits in the result of stat. If any of the three are set, Git will save the file using a tree entry in which the mode is 100755. Otherwise Git will save the file using a tree entry in which the mode is 100644.

This does not depend on any of the other mode bits (except that the file must be a file, not a directory—Git does not save directories—nor a symbolic link). A file whose actual mode is 100 (--x------) is saved as 100755.




回答2:


Only executable bit. Git concentrates on storing file content.

If you need to preserve something else you have to to do it yourself or use some kind of metadata helpers like metastore or gibak.



来源:https://stackoverflow.com/questions/45578579/what-file-metadata-is-preserved-by-git

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!