Show the permission of a indexed file in git

Viewed 7144

This is related to another question I recently asked about storing a non-bare repository in Dropbox for easy movement between computers, so it may be helpful to read that question for background.

The gist is that the fileMode keeps reporting a diff for some number of files. I can't find a way to reproduce it consistently, but it happens frequently. What I've noticed is that the file, which has 644 permissions on both machines often reports a diff from 755 on one of the machines. This makes me think that Git believes the executable bit is set, but I can't figure out whether I can actually see how Git has that bit set.

2 Answers

Use gitk as follows

$ gitk path/to/repository/file

In the opened window, under dashed line you can see six digits. The last three are the file permissions.

...
------------------------------- path/to/repository/file -------------------------
index a5e14048..08ce8948 100644
...

In the example above 6 digits are 100644 and file permission is 644

Related