Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

View permissions change in Git

Tags:

git

Before I commit some files, how can I see the file permission changes to files? I have some files that git status says had changed and should be added to commit but git diff doesn't show anything. Thanks

like image 629
Clutch Avatar asked Feb 23 '11 17:02

Clutch


People also ask

How do I see file permissions in git?

Use git ls-files -s <file> : Show staged contents' mode bits, object name and stage number in the output. Note that Git only tracks files' executable bit. You'll only ever see 644 or 755.

Does git change file permissions?

By default, git will update execute file permissions if you change them. It will not change or track any other permissions. If you don't see any changes when modifying execute permission, you probably have a configuration in git which ignore file mode.

Does git keep track of file permissions?

Git Tracks ONLY the Executable Bit of the Permissions for the User Who Owns the File.


2 Answers

Well, since the question has been edited to ask something different, here's a different answer:

git status -v will list mode changes as well as diffs. You can filter this down to just mode changes by running it through grep with a context filter: git status -v | grep '^old mode' -C 1 (sample result below)

diff --git a/matrix.cc b/matrix.cc
old mode 100644
new mode 100755
like image 193
Jeff Ferland Avatar answered Oct 20 '22 09:10

Jeff Ferland


A straightforward answer to your question:

git diff --summary

will output something like this:

mode change 100644 => 100755 assets/README.md
mode change 100644 => 100755 assets/css/app.css
mode change 100644 => 100755 assets/js/app-monitor.js
mode change 100644 => 100755 assets/js/app.js`
like image 27
Eugen Mihailescu Avatar answered Oct 20 '22 10:10

Eugen Mihailescu