What file metadata is preserved by Git?

Viewed 3633

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?

3 Answers

https://git.wiki.kernel.org/index.php/ContentLimitations

By design, git cannot track other aspects of the filesystem, including:

  • File modes (except for the "executable" bit, and being symbolic link)
  • File ownership (commits, however, remember 'author' and 'committer' info)
  • File modification and access times (these are set to checkout time for files which are modified during checkout)
  • File ACLs and extended attributes
  • Hard links
  • Empty directories (although it is not a fundamental limitation, git just automatically removes empty directories and does not add empty directories)
Related