Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Git Hooks: How to Make Friends
Search
Joseph Hsu
April 14, 2012
Programming
5
690
Git Hooks: How to Make Friends
Joseph Hsu
April 14, 2012
Tweet
Share
More Decks by Joseph Hsu
See All by Joseph Hsu
Ruby 2.0
jhsu
3
210
API Versioning
jhsu
1
1.4k
Other Decks in Programming
See All in Programming
チーム開発の “地ならし"
konifar
8
6.6k
AI時代もSEOを頑張っている話
shirahama_x
0
200
TypeScript 5.9 で使えるようになった import defer でパフォーマンス最適化を実現する
bicstone
1
560
FluorTracer / RayTracingCamp11
kugimasa
0
140
非同期処理の迷宮を抜ける: 初学者がつまづく構造的な原因
pd1xx
1
360
Module Harmony
petamoriken
2
590
AIコードレビューがチームの"文脈"を 読めるようになるまで
marutaku
0
240
最新のDirectX12で使えるレイトレ周りの機能追加について
projectasura
0
330
CloudNative Days Winter 2025: 一週間で作る低レイヤコンテナランタイム
ternbusty
7
1.8k
堅牢なフロントエンドテスト基盤を構築するために行った取り組み
shogo4131
3
1.3k
【レイトレ合宿11】kagayaki_v4
runningoutrate
0
190
Evolving NEWT’s TypeScript Backend for the AI-Driven Era
xpromx
0
220
Featured
See All Featured
GitHub's CSS Performance
jonrohan
1032
470k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
10
690
Why Our Code Smells
bkeepers
PRO
340
57k
For a Future-Friendly Web
brad_frost
180
10k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
36
6.1k
Embracing the Ebb and Flow
colly
88
4.9k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
Automating Front-end Workflow
addyosmani
1371
200k
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
9
990
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.6k
Six Lessons from altMBA
skipperchong
29
4.1k
Transcript
by Joseph Hsu GIT HOOKS HOW TO MAKE FRIENDS
GIT HOOKS by Joseph Hsu HOW TO MAKE FRIENDS
@JHSU Joe Hsu
We all use git (right?)
DVCS - distributed version control system
None
None
None
I wish I could automate...
too lazy to...
Git hooks
Git hooks http://book.git-scm.com/5_git_hooks.html Hooks are little scripts you can place
in $GIT_DIR/ hooks directory to trigger action at certain points.
post-commit no parameters cannot affect the outcome of git-commit
pre-commit run tests, linting
post-receive # <oldrev> <newrev> <refname>
and more...
setup
where? project .git/hooks new repos /usr/share/git-core/templates/hooks/
chmod +x
post-hook What happens after depends on exit status, exit of
non-zero leaves dirty state
pre-commit #!/usr/bin/env bash exit 1
#!/usr/bin/env bash git reset HEAD^ --hard post-commit
Useful examples
cowsay commit-msg * WOOF * * WOOF *
fixing bugs, BRO commit-msg
git commit -m “stuff” commit-msg
None
None
None
AlTeRnAtInG cAsE commit-msg
https://github.com/jhsu/githooks
Thanks.