Skip to content

Instantly share code, notes, and snippets.

@danieljurek
Created April 22, 2021 04:25
Show Gist options
  • Save danieljurek/280ede135b3085343e2e922c4fd453f5 to your computer and use it in GitHub Desktop.
Save danieljurek/280ede135b3085343e2e922c4fd453f5 to your computer and use it in GitHub Desktop.
Windows detect duplicate filenames in git repo
# Windows files are case-insensitive by default. It is possible
# to have two files with different casing in a git repository
# (e.g. foo.txt and FOO.txt). In these situations only one file
# will appear in the folder. Changes to this file will confuse
# git. Use this script to check for the existence of these
# duplicated files.
$gitFileHash = @{};
$gitFiles = git ls-files
foreach ($file in $gitFiles) {
if ($gitFileHash.ContainsKey($file)) {
Write-Error "Duplicate file detected: $file"
} else {
$gitFileHash[$file] = $true
}
}
@Illegal-Services
Copy link

Nice, how about folders?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment