Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
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
顧客の画像データをテラバイト単位で配信する 画像サーバを WebP にした際に起こった課題と その対応策 ~継続的な取り組みを添えて~
takutakahashi
3
600
PicoRuby on Rails
makicamel
2
140
AI駆動のマルチエージェントによる業務フロー自動化の設計と実践
h_okkah
0
220
システム成長を止めない!本番無停止テーブル移行の全貌
sakawe_ee
1
280
NPOでのDevinの活用
codeforeveryone
0
880
The Niche of CDK Grant オブジェクトって何者?/the-niche-of-cdk-what-isgrant-object
hassaku63
1
550
テストから始めるAgentic Coding 〜Claude Codeと共に行うTDD〜 / Agentic Coding starts with testing
rkaga
15
5.3k
Python型ヒント完全ガイド 初心者でも分かる、現代的で実践的な使い方
mickey_kubo
1
180
テスト駆動Kaggle
isax1015
1
510
20250708_JAWS_opscdk
takuyay0ne
2
120
AI時代の『改訂新版 良いコード/悪いコードで学ぶ設計入門』 / ai-good-code-bad-code
minodriven
23
9.1k
RailsGirls IZUMO スポンサーLT
16bitidol
0
200
Featured
See All Featured
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
248
1.3M
Measuring & Analyzing Core Web Vitals
bluesmoon
7
510
A Modern Web Designer's Workflow
chriscoyier
695
190k
Product Roadmaps are Hard
iamctodd
PRO
54
11k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
50k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.4k
Practical Orchestrator
shlominoach
189
11k
Gamification - CAS2011
davidbonilla
81
5.4k
How GitHub (no longer) Works
holman
314
140k
Balancing Empowerment & Direction
lara
1
440
Unsuck your backbone
ammeep
671
58k
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.