Automatically Format Changed Files in Git

Interested in learning how to automatically format changed files in git?

1
git ls-files -m -o --exclude-standard | xargs -L 1 mix format

Here, we're listing all files tracked by git (git ls-files) that have been modified (-m) as well as any other files including new files (-o) (excluding files that are usually excluded anyways --exclude-standard) and feeding them one by one (xargs -L 1) to mix format.

You can swap out mix format for other tools.