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
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
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
AIキャラアプリkaiwaの低遅延音声通話基盤をどう作ったか - AWS Gravitonで支える低遅延・低コストAI Agent基盤
mogamit
0
170
Apache Hive: Toward a Cloud Native Lakehouse
okumin
0
140
symfony/aiとlaravel/boost
77web
0
130
はてなアカウント基盤 State of the Union
cockscomb
1
1.3k
AI 輔助遺留系統現代化的經驗分享
jame2408
1
1.2k
AI時代、エンジニアはどう育つのか -未経験エンジニアの成長を間近で見て考えたこと-
thasu0123
0
130
任せる範囲はこう広がった / How the Scope of AI Delegation Has Expanded
nrslib
1
260
才能?センス?知らん、 続けたもん勝ちだ。-- 結婚・出産・癌を越えてなお、私がプロダクトを創り続ける理由
16bitidol
2
870
JAWS-UG横浜 #102 AWSサ終供養LT会 成仏できない AWS サービスたち 〜本日、三体供養します〜
maroon1st
0
210
Hatena Engineer Seminar #37「言語モデルの活用に関する研究」
slashnephy
0
530
Apache Hive: そしてCloud Native Lakehouseへ
okumin
1
140
AI時代の仕事技芸論〜ソフトウェア開発で「遊ぶように働く」職人的熟達のすすめ(スクフェス仙台 2026バージョン)
kuranuki
0
660
Featured
See All Featured
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
11k
Reality Check: Gamification 10 Years Later
codingconduct
0
2.2k
Unsuck your backbone
ammeep
672
58k
The Pragmatic Product Professional
lauravandoore
37
7.4k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
420
Being A Developer After 40
akosma
91
590k
Balancing Empowerment & Direction
lara
6
1.2k
New Earth Scene 8
popppiees
3
2.4k
The #1 spot is gone: here's how to win anyway
tamaranovitovic
3
1.1k
VelocityConf: Rendering Performance Case Studies
addyosmani
333
25k
sira's awesome portfolio website redesign presentation
elsirapls
0
300
Fashionably flexible responsive web design (full day workshop)
malarkey
408
67k
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.