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?
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
.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With