Created
March 10, 2026 23:47
-
-
Save otac0n/07acc53454be80091e60aff3c1751167 to your computer and use it in GitHub Desktop.
A PowerShell snipped that uses Git to find identical files that should be updated at the same time.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $hashMap = @{}; git diff-tree -r --find-renames --no-commit-id --diff-filter=M HEAD^ HEAD -- "*.png" | %{ | |
| $p = $_ -split '\s+', 6; | |
| $hashMap[$p[2]] = ($hashMap[$p[2]] ?? @()) + $p[3]; | |
| }; | |
| git ls-tree -r HEAD | ?{ $_ -like "*.png" } | %{ | |
| $p = $_ -split '\s+', 4; | |
| ($hashMap[$p[2]] ?? @()) | Select-Object -Unique | %{ "{0} {1}" -f $_, $p[3] } | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment