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
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
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
iOSDC2026登壇資料.pdf
riofujimon
0
200
AWSに止められる覚悟してますか?
morizo_1984
2
480
App Intentsのビルドプロセスを支える技術
kntkymt
0
470
速習iPhone Duo対応
yuukiw00w
2
900
UnityでSystem.Net.WebSocketsなWebSocketサーバが動かないのでUnity Monoのコードを覗いてみた / about implementing websocket server with unity mono
drumath2237
1
490
標準パッケージに uuid が追加された 背景から見る Go らしい意思決定 / go_127_uuid_decision
convto
5
9.1k
設計次第でAIコードの読む量は減らせる / designing-for-code-reading
minodriven
29
12k
Streamlitで実現する自然言語データアプリ開発
ayumu_yamaguchi
1
320
フロントエンドUIフレームワークのこれまでとこれから
ssssota
5
3.1k
ハーネス設計入門 〜 基礎知識の整理から実務へのステップアップ 〜
kinopeee
18
19k
Agents on Rails - Rails at Scale 2026
irinanazarova
0
290
JRuby: Past, Present, and Future
headius
0
210
Featured
See All Featured
Evolving SEO for Evolving Search Engines
ryanjones
0
300
Optimising Largest Contentful Paint
csswizardry
37
4k
Become a Pro
speakerdeck
PRO
31
6.3k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Utilizing Notion as your number one productivity tool
mfonobong
4
600
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.9k
Exploring anti-patterns in Rails
aemeredith
4
520
WENDY [Excerpt]
tessaabrams
14
39k
Java REST API Framework Comparison - PWX 2021
mraible
34
9.7k
Deep Space Network (abreviated)
tonyrice
0
340
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.8k
The Curse of the Amulet
leimatthew05
3
15k
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.