Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are file permissions and owner:group properties included in git commits?

Tags:

git

Are file permissions and owner:group properties included in git commits? How are these properties of files and directories handled throughout the git pipeline [commit, push, pull, merge, etc] ?

like image 208
ted.strauss Avatar asked Apr 22 '15 14:04

ted.strauss


1 Answers

Files in Git are assigned either 644 (owner rw-, group and other r--) or 755 (owner rwx, group and other r-x). Ownership information is not stored.

This is deliberate, and well-explained by this post by Git's maintainer, Junio Hamano:

Actually in a very early days, git used to record the full (mode & 0777) for blobs.

Once people started using git, everybody realized that it had a very unpleasant side effect that the resulting tree depended on user's umasks, because one person records a blob with mode 664 and the next person who modifies the file would record with mode 644, and it made it very hard to keep track of meaningful changes to the source code. This issue was fixed long time ago with commit e447947 (Be much more liberal about the file mode bits., 2005-04-16).

like image 139
Chris Avatar answered Sep 27 '22 16:09

Chris