$30 off During Our Annual Pro Sale. View Details »
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
ソフトウェア設計の課題・原則・実践技法
masuda220
PRO
26
22k
バックエンドエンジニアによる Amebaブログ K8s 基盤への CronJobの導入・運用経験
sunabig
0
140
愛される翻訳の秘訣
kishikawakatsumi
1
310
Context is King? 〜Verifiability時代とコンテキスト設計 / Beyond "Context is King"
rkaga
9
1.1k
Why Kotlin? 電子カルテを Kotlin で開発する理由 / Why Kotlin? at Henry
agatan
2
7k
MAP, Jigsaw, Code Golf 振り返り会 by 関東Kaggler会|Jigsaw 15th Solution
hasibirok0
0
230
AIコーディングエージェント(skywork)
kondai24
0
160
connect-python: convenient protobuf RPC for Python
anuraaga
0
400
ハイパーメディア駆動アプリケーションとIslandアーキテクチャ: htmxによるWebアプリケーション開発と動的UIの局所的適用
nowaki28
0
400
Tinkerbellから学ぶ、Podで DHCPをリッスンする手法
tomokon
0
120
dnx で実行できるコマンド、作ってみました
tomohisa
0
140
STYLE
koic
0
170
Featured
See All Featured
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
132
19k
Principles of Awesome APIs and How to Build Them.
keavy
127
17k
How To Stay Up To Date on Web Technology
chriscoyier
791
250k
Stop Working from a Prison Cell
hatefulcrawdad
273
21k
Mobile First: as difficult as doing things right
swwweet
225
10k
How STYLIGHT went responsive
nonsquared
100
6k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
1.8k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.5k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.6k
Done Done
chrislema
186
16k
The Invisible Side of Design
smashingmag
302
51k
Build your cross-platform service in a week with App Engine
jlugia
234
18k
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.