Better Living Through 

 Git Hooks

What are some things you try to do before you commit or push your code?

git hooks can

run your tests

standardize commit messages

clean up your workflow, you slobs

(No waiting for your build!)

Lint Your Code

and more

pre-commit

automated commit msg

prepare-commit-msg

commit msg made

commit-msg
post-commit

commit lifecycle

pre-commit

Let's write a

hook!

const add2 = number => number + 2;
const add3 = number => number + 3;

module.exports = { add2, add3 };
const addNum = num => {
  const add = number => number + num;

  return add;
}

const add2 = addNum(2);
const add3 = addNum(3);

module.exports = { add2, add3 };

Before

After

(this code doesn't

really matter)

#!/bin/sh

echo "\Running tests:\n"

npm run test

when things are dandy

Let's say I wrote bad code that does not pass my tests:

when things are not dandy

Be a good person.

use git hooks.

thatpersonfromthething.com

Made with Slides.com