Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Git Hooks: How to Make Friends
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Joseph Hsu
April 14, 2012
Programming
710
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
240
API Versioning
jhsu
1
1.4k
Other Decks in Programming
See All in Programming
巨大モノリシックアプリ モダン化大作戦
ktcryomm
1
1.1k
TiDB Cloudのカスタムコントローラーによるオートスケール対応
takaidohigasi
0
130
App Intentsのビルドプロセスを支える技術
kntkymt
0
420
AI活用は、個人から組織へ|マルチプレイヤーエージェントハーネス「QM」の社内活用事例 / AI use is moving from individuals to orgs
rkaga
1
160
IBM Bob Dojo #1 仕様駆動開発入門
oniak3ibm
PRO
0
160
LoopHub - ローカルで動く GitHub で、AI と共同開発
jugyo
1
570
iOSDC2026登壇資料.pdf
riofujimon
0
180
AgentCore CLI で進化した AWS での AI エージェントの作り方 : 必要な機能を必要な時に
icoxfog417
PRO
3
370
Snowflakeで業務アプリを作ろう。 Snowflakeのアプリ機能解説&実践ガイド
ayumu_yamaguchi
2
300
iOS 27でニュースアプリはどう変わる!? 〜日経電子版の新機能対応と、開発事例から〜
lynnswap
1
11k
新卒PdEのリアル
ryu1013
1
510
C#の現在地 進化の歴史と、AI時代の.NET Everywhere
neuecc
4
3.5k
Featured
See All Featured
The Curse of the Amulet
leimatthew05
3
15k
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
260
We Are The Robots
honzajavorek
0
380
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.6k
Testing 201, or: Great Expectations
jmmastey
46
8.3k
Being A Developer After 40
akosma
91
590k
Scaling GitHub
holman
464
140k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
56
3.5k
Prompt Engineering for Job Search
mfonobong
0
460
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
500
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.8k
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
900
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.