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
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.
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.
Git Tracks ONLY the Executable Bit of the Permissions for the User Who Owns the File.
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
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`
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