I inadvertedly change the permissions of my entire tree and commit that change along with other content changes.
I use something like :
tar -czf deploy.tar git diff --name-only v1 v2
to generate a tar with the modified files between two tags, the problem is that now because of the permissions change almost all my tree is listed as modified.
Is there a way that I could tell git diff
to ignore those files which only has the permissions changed?
If you set core. filemode=false then git will ignore execute bit changes, no need to change local permissions.
Git Tracks ONLY the Executable Bit of the Permissions for the User Who Owns the File.
We use the git diff -w command to ignore all whitespace differences. It will ignore spaces at the beginning, middle, and end of lines.
It means that the file mode changed from 755 to 644, but the contents were not altered. git diff is exactly what you are looking for - it shows the changes from unstaged files to the last commit. git diff --cached is for staged files. Follow this answer to receive notifications.
This will tell git to ignore permissions:
git config core.filemode false
Use the -G<regex>
option ("Look for differences whose patch text contains added/removed lines that match <regex>
.") searching for any changes at all - i.e. .
. Permissions-only changes don't match this, so they are ignored.
So: git diff -G.
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