Skip to content

Instantly share code, notes, and snippets.

@puttputt
Last active January 14, 2020 17:28
Show Gist options
  • Save puttputt/8bc8ffd961b2546747edcec8d569fa55 to your computer and use it in GitHub Desktop.
Save puttputt/8bc8ffd961b2546747edcec8d569fa55 to your computer and use it in GitHub Desktop.
Prettier Autoformat Git History
## From Marcus Motill https://medium.com/millennial-falcon-technology/reformatting-your-code-base-using-prettier-or-eslint-without-destroying-git-history-35052f3d853e
git filter-branch --tree-filter '\
prettier --no-config --single-quote --tab-width=4\
--print-width=128 --arrow-parens=always --trailing-comma=all\
--write "**/**.ts" "**/**.html" || \
echo “Error formatting, possibly invalid JS“' -- --all
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment