Git Hooks
For The Front End Developer
About Me
Employer: Unicon, Inc
Role: Sr. UI Developer
Blog: blog.bradleygore.com
Family: Carolina and Garrison
I <3 Programming
Time to Git Hooked
1) What are Git Hooks?
2) Why are they useful?
3) Some Examples
4) Demo
5) Recap/Q&A
6) (If all goes well) Applause :)
Remote Hooks
●
pre|post-receive
●
update
●
post-update
Local Hooks
●
pre|post-commit
●
post-checkout
●
pre-push
What Are Git Hooks?
Scripts that run in reaction to specific git
events such as commit, push, checkout...
Where Hooks Live
PROJECT ROOT
.git
hooks
post-checkout
pre-commit
post-commit
Git-Hook Scripts
are named for the
event or stage at
which they are to
be ran.
why use
Why Use Git Hooks?
Polish Up The Workflow
IDE
Takes care of the big things - file encoding, code
quality helps, syntax highlighting...
[GULP] TASKS
Manage building dist files, running checks and tests,
compiling css, concatenation...
GIT HOOKS
Final checks on all (or only modified) files, final
instructions to user...
examples
Some Example Scripts
That looks fun
commit-msg hook courtesy of githooks.com
Oooh, more fun
pre-commit hook courtesy of codeinthehole.com
Another Way (A Better Way?)
●
NodeJS -> Can interpret javascript files
●
Gulp -> Easily build tasks for any stage in
the git workflow, likely can reuse existing
tasks
●
No shell scripts!!
What if you could use the same
tools/language you’re already using?
demo
Thank You!!
Demo: https://goo.gl/fhPpBf
Twitter: @dotNetKnight
Email: bradley@bradleygore.com

Git hooks for front end developers

Editor's Notes

  • #10 From here, will go to a demo showing how we can achieve a pre-commit hook using NodeJS and gulp tasks. GitHub project - https://goo.gl/fhPpBf