Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What file metadata is preserved by Git?

Tags:

git

metadata

What file metadata is preserved by Git?

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

As I know executable permission is treated specially:

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

Is anything else preserved by Git?

like image 801
gavenkoa Avatar asked Aug 08 '17 21:08

gavenkoa


2 Answers

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.

like image 87
torek Avatar answered Sep 23 '22 14:09

torek


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.

like image 28
phd Avatar answered Sep 21 '22 14:09

phd