Today I Learned

Elixir Git pre-commit hooks

Better tooling and development flow for elixir development

0 min read git elixir programming

Part of my Elixir development flow is to run certain checks and test before pushing changes to the remote. The main thing that I want is to make sure my code is following the standard Elixir formating with mix format.

We can easily do this with a pre-commit hook:

#!/bin/bash
cd `git rev-parse --show-toplevel`
mix format --check-formatted
if [ $? == 1 ]; then
   echo "commit failed due to format issues..."
   exit 1
fi

Your turn

Let's compare notes

Got a different take, a story that backs this up, or a question it left open? Reply on X, or get in touch. I read every reply.

Open source

Bloccs

Typed, supervised dataflow on the BEAM. Describe a system as a typed graph and check its connections before it runs.

Read the guides →

Publication

The Pragmatic CTO

Engineering leadership, scaling teams, and the decisions that shape a technology organization.

Subscribe →

Further reading