Skip to content

Instantly share code, notes, and snippets.

@MaximeCulea
Last active October 30, 2023 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MaximeCulea/c845ce48707d3ddee2a844224bcf56ce to your computer and use it in GitHub Desktop.
Save MaximeCulea/c845ce48707d3ddee2a844224bcf56ce to your computer and use it in GitHub Desktop.
Clean a cloned git repo to avoid conflicts between multiple OS
#!/bin/bash
# Clean a cloned git repo to avoid conflicts between multiple OS
# To install
## download the file clean-repo.sh and place it somewhere
## in bashrc or zhrc add an alias like so: alias cleangit="bash /path/to/clean-repo.sh"
## in the terminal into the project, simply lunch the alias: cleangit
# activate xtrace to have verbose display https://askubuntu.com/a/983069/1742321
set -x
# autorcrlf https://www.delftstack.com/fr/howto/git/git-lf-will-be-replaced-by-crlf/
git config core.autocrlf false
git config --system core.autocrlf false
git config --global core.autocrlf false
# ignorecase https://docs.syntevo.com/SmartGit/HowTos/Fixing-the-Git-configuration-for-a-local-repository
git config --unset core.ignoreCase
git config --system --unset core.ignoreCase
git config --global --unset core.ignoreCase
# disable git track of chmod changes
git config core.fileMode false
git config --global core.fileMode false
# apply good chmod for mac access
find . -type d -exec chmod a+rwx {} \;
find . -type f -exec chmod a+rw {} \;
# deactivate xtrace
set +x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment