Detecting file permission changes' in a git repo
When you change some file permissions, git detects it and marks it as changed. Now, imagine you want to revert some file permissions in a git system.
git diff --summary
gives you
mode change 100644 => 100755 Zend/Crypt/DiffieHellman.php
but does not inform you if the content has also changed (AFAIK)
You can output the names of the files that have changes (+++ / ---) and also permission changes:
git diff --summary |grep 'mode change ' | awk '{print $6}' | \
while read file_; do \
diffed=`git diff $file_|egrep '\+\+\+|---'|wc -l`;
if test 0 -ne $diffed; then
echo $file_;
fi;
done
You can decide to commit those files first and then the commit/revert the rest, as there are no changes left.
Written by Alvaro Garcia
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Changes
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#