Skip to content

Instantly share code, notes, and snippets.

@brunos3d
Created December 18, 2024 04:39
Show Gist options
  • Save brunos3d/b0afcc596a3367d1fdbc6ab6830d612f to your computer and use it in GitHub Desktop.
Save brunos3d/b0afcc596a3367d1fdbc6ab6830d612f to your computer and use it in GitHub Desktop.
This script recursively find git repos from the current folder and revert all files with permission changes
find . -type d -name ".git" -exec sh -c 'repo_dir=$(dirname "{}"); echo "Processando repositório: $repo_dir"; cd "$repo_dir" && [ -d .git ] && git diff -p -R --no-ext-diff --no-color --diff-filter=M | grep -E "^(diff|(old|new) mode)" --color=never | git apply' \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment