Skip to content

Instantly share code, notes, and snippets.

@realityforge
Created March 25, 2012 22:56
Show Gist options
  • Save realityforge/2200752 to your computer and use it in GitHub Desktop.
Save realityforge/2200752 to your computer and use it in GitHub Desktop.
Convert a repository to Unix EOL
#!/bin/bash
# If fromdos is not present on your system you can try the slower: "perl -pi -e 's/\r\n/\n/;'"
find . \( ! -name '.git' -type f -and -name '*.sql' -or -name '*.textile' -or -name '*.css' -or -name '*.html' -or -name '*.java' -or -name '*.js' -or -name '*.jsp' -or -name '*.properties' -or -name '*.txt' -or -name '*.xml' -or -name '*.xsd' -or -name '*.xsl' -or -name '*.rb' -or -name '*.haml' -or -name '*.rake' -or -name '*.sass' -or -name '*.rhtml' -or -name '*.yml' -or -name '*.yaml' -or -name 'LICENSE' -or -name 'CHANGELOG' -or -name 'Rakefile' -or -name 'rakefile' -or -name 'Buildfile' -or -name 'buildfile' -or -name '*.gemspec' -or -name '.gitignore' -or -name '.gitattributes' \) -exec fromdos {} \;
export GIT_URL=$1
git clone --mirror $GIT_URL mydir
cd mydir
git filter-branch -f --tree-filter ~/bin/all2dos.sh --tag-name-filter cat --prune-empty -- --all
git push -f -u origin --all
git push -f --tags
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment