Skip to content

Instantly share code, notes, and snippets.

@organom
Created December 2, 2020 14:37
Show Gist options
  • Save organom/63bc647aeeed54632dea963770c8fe0f to your computer and use it in GitHub Desktop.
Save organom/63bc647aeeed54632dea963770c8fe0f to your computer and use it in GitHub Desktop.
git-unset-filemode
#!/bin/bash
git config --global --unset-all core.filemode
git config --global core.filemode false
find . -name .git -type d -exec sh -c '(cd {}; cd ..; git config --unset-all core.filemode; git_temp=`git status -s`; if [ -n "${git_temp}" ]; then (echo $PWD && git status -s && echo); fi;)' \;
@organom
Copy link
Author

organom commented Dec 2, 2020

When I copied my full git directory from a linux machine to windows I faced the issue of old mode / new mode. This script sets the global ignore and then goes over all git directories on the current path and removed any local set core.filemode (since they override the global set). Run inside WSL

Its also probably useful to set the crlf:

git config --global --unset-all core.eol
git config --global core.eol crlf

and add the git config --unset-all core.eol to the script

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