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
700
5
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Git Hooks: How to Make Friends
Joseph Hsu
April 14, 2012
More Decks by Joseph Hsu
See All by Joseph Hsu
Ruby 2.0
jhsu
3
230
API Versioning
jhsu
1
1.4k
Other Decks in Programming
See All in Programming
OSINT for SRE: 学術論文とポストモーテムから探る システム障害の共通パターン / SRE NEXT 2026
tomoyk
1
3.9k
共通化で考えるべきは、実装より公開する型だった
codeegg
0
250
トークンをケチるな、設計しろ:GitHub Copilotを賢く使うコンテキスト戦略
ochtum
0
320
音楽のための関数型プログラミング言語mimiumにおける多段階計算の活用
tomoyanonymous
1
340
『コードを書く以外の』エンジニアリング〜課金基盤移行プロジェクト推進のためのTips4選
yuriko1211
0
510
フィードバックで育てるAI開発
kotaminato
1
120
自作OSでスライド発表する
uyuki234
1
3.9k
SLOをサービス品質の共通言語にするために 取り組んできたこと
wakana0222
0
510
ソフトウェア設計に溶けるインフラ ― AWS CDK のインフラ認識論
konokenj
2
550
Welcome to the "Parametricity" 🏙️ − Generic だけど Specific な世界 −
guvalif
PRO
1
170
PHPだって関数型したい 〜できること、できないこと〜 / fp-in-php
jsoizo
0
220
Generative UI & AI-Assistants for Your Angular Solutions
manfredsteyer
PRO
0
110
Featured
See All Featured
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
460
The browser strikes back
jonoalderson
0
1.4k
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
1
2.1k
Reflections from 52 weeks, 52 projects
jeffersonlam
356
21k
Typedesign – Prime Four
hannesfritz
42
3.1k
Six Lessons from altMBA
skipperchong
29
4.3k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
880
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
400
The untapped power of vector embeddings
frankvandijk
2
1.8k
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
2
420
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
170
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
220
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.