Skip to content

Instantly share code, notes, and snippets.

@netspencer
Created February 1, 2018 20:51
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 netspencer/c1d6131ae3fd1e6f15996fc7200b31aa to your computer and use it in GitHub Desktop.
Save netspencer/c1d6131ae3fd1e6f15996fc7200b31aa to your computer and use it in GitHub Desktop.
format git history with prettier
git filter-branch --tree-filter 'git show $GIT_COMMIT --name-status\
| grep "^[AM]" | grep ".js$" | cut -f2 | tr "\n" " "\
xargs prettier --no-config --single-quote --no-semi \
--print-width=110 --write {} || \
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