Skip to content

Instantly share code, notes, and snippets.

@ipoddubny
Created February 5, 2013 08:08
Show Gist options
  • Save ipoddubny/4713009 to your computer and use it in GitHub Desktop.
Save ipoddubny/4713009 to your computer and use it in GitHub Desktop.
Rewriting history with git filter-branch
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# !!! Don't forget to backup first !!!
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# !!! Everyone who has forked from your repository will need to start over !!!
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# removing .settings folder and .project file
git filter-branch --index-filter 'git ls-files -- .settings .project | xargs git update-index --remove' --tag-name-filter cat --prune-empty -f -- --all
# cleaning up history from bad commits with CRLF files
git filter-branch --tree-filter "find . -type f | xargs dos2unix -q" --tag-name-filter cat --prune-empty -f -- --all
# pushing it back
git push --force --all origin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment