Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save miladrahimi/db5172289ab5ca349df7020ce5ac73b8 to your computer and use it in GitHub Desktop.
Save miladrahimi/db5172289ab5ca349df7020ce5ac73b8 to your computer and use it in GitHub Desktop.
Revert changed file permissions in Git (before commit)
git diff -p \
| grep -E '^(diff|old mode|new mode)' \
| sed -e 's/^old/NEW/;s/^new/old/;s/^NEW/new/' \
| git apply
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment