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
Agentic Applications with Symfony
el_stoffel
2
270
RuboCop: Modularity and AST Insights
koic
0
100
海外のアプリで見かけたかっこいいTransitionを真似てみる
shogotakasaki
1
160
gen_statem - OTP's Unsung Hero
whatyouhide
1
190
State of Namespace
tagomoris
4
760
SwiftUI API Design Lessons
niw
1
260
SQL Server ベクトル検索
odashinsuke
0
170
Memory API : Patterns, Performance et Cas d'Utilisation
josepaumard
0
110
PHPで書いたAPIをGoに書き換えてみた 〜パフォーマンス改善の可能性を探る実験レポート〜
koguuum
0
140
リアルタイムレイトレーシング + ニューラルレンダリング簡単紹介 / Real-Time Ray Tracing & Neural Rendering: A Quick Introduction (2025)
shocker_0x15
1
290
フロントエンドテストの育て方
quramy
11
2.9k
DataStoreをテストする
mkeeda
0
280
Featured
See All Featured
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
StorybookのUI Testing Handbookを読んだ
zakiyama
29
5.6k
VelocityConf: Rendering Performance Case Studies
addyosmani
328
24k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
19
1.1k
It's Worth the Effort
3n
184
28k
Speed Design
sergeychernyshev
29
880
Testing 201, or: Great Expectations
jmmastey
42
7.4k
How to Think Like a Performance Engineer
csswizardry
23
1.5k
4 Signs Your Business is Dying
shpigford
183
22k
Scaling GitHub
holman
459
140k
Navigating Team Friction
lara
184
15k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
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.