title: How do I run a code formatter over my source without modifying git history?
body: <p>I am trying to format an entire repo using a code formatter tool. In doing so, I want to keep information about who committed which line, so that commands like <code>git blame</code> still show the correct information. By this, I mean it should show the author that previously edited each line (before it was formatted).</p>
  
  <p>There is the git filter-branch command which allows you to run a command against each revision of the repo starting from the beginning of time.</p>
  
  <pre><code>git filter-branch --tree-filter '\
    npx prettier --write "src/main/web/app/**/**.{js, jsx}" || \
    echo "Error: no JS files found or invalid syntax"' \
    -- --all
  </code></pre>
  
  <p>It will take forever to run this and really I don't care about the past. I just want to format the master branch going forward without changing ownership of each line. How can I do this? I tried playing with the <code>rev-list</code> at the end and other filter types but it still doesn't work. There must be a way to format the codebase while preserving the author information for each line.</p>