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
680
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
kintone開発を効率化するためにチームで試した施策とその結果を大放出!
oguemon
0
330
Domain-Driven Design (Tutorial)
hschwentner
13
22k
ML.NETで始める機械学習
ymd65536
0
240
AIレビュー導入によるCIツールとの共存と最適化
kamo26sima
1
620
Better Code Design in PHP
afilina
0
180
「個人開発マネタイズ大全」が教えてくれたこと
bani24884
1
290
Boost Performance and Developer Productivity with Jakarta EE 11
ivargrimstad
0
1.1k
Amazon Bedrockマルチエージェントコラボレーションを諦めてLangGraphに入門してみた
akihisaikeda
1
160
CSS Linter による Baseline サポートの仕組み
ryo_manba
1
160
PHPカンファレンス名古屋2025 タスク分解の試行錯誤〜レビュー負荷を下げるために〜
soichi
1
740
Google Cloudとo11yで実現するアプリケーション開発者主体のDB改善
nnaka2992
1
110
GoとPHPのインターフェイスの違い
shimabox
2
220
Featured
See All Featured
Code Review Best Practice
trishagee
67
18k
What's in a price? How to price your products and services
michaelherold
244
12k
Visualization
eitanlees
146
15k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
11
1.3k
Writing Fast Ruby
sferik
628
61k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
27
1.6k
Documentation Writing (for coders)
carmenintech
68
4.6k
Making Projects Easy
brettharned
116
6k
We Have a Design System, Now What?
morganepeng
51
7.4k
Art, The Web, and Tiny UX
lynnandtonic
298
20k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
30
2.3k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
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.