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
事業戦略を理解してソフトウェアを設計する
masuda220
PRO
11
2.7k
AIエージェントによるテストフレームワーク Arbigent
takahirom
0
280
イベントソーシングとAIの親和性ー物語とLLMに理解できるデータ
tomohisa
1
160
ts-morph実践:型を利用するcodemodのテクニック
ypresto
1
540
tsconfigのオプションで変わる型世界
keisukeikeda
1
130
CQRS/ESのクラスとシステムフロー ~ RailsでフルスクラッチでCQRSESを組んで みたことから得た学び~
suzukimar
0
200
推論された型の移植性エラーTS2742に挑む
teamlab
PRO
0
150
DevTalks 25 - Create your own AI-infused Java apps with ease
kdubois
2
130
バランスを見極めよう!実装の意味を明示するための型定義 TSKaigi 2025 Day2 (5/24)
whatasoda
2
780
Cursor Meetup Tokyo ゲノミクスとCursor: 進化と制約のあいだ
koido
1
420
Proxmoxをまとめて管理できるコンソール作ってみました
karugamo
1
410
PT AI без купюр
v0lka
0
200
Featured
See All Featured
Navigating Team Friction
lara
186
15k
How STYLIGHT went responsive
nonsquared
100
5.6k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Side Projects
sachag
454
42k
VelocityConf: Rendering Performance Case Studies
addyosmani
329
24k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
30
2.4k
Code Review Best Practice
trishagee
68
18k
Embracing the Ebb and Flow
colly
85
4.7k
Fireside Chat
paigeccino
37
3.5k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
137
34k
Fashionably flexible responsive web design (full day workshop)
malarkey
407
66k
What's in a price? How to price your products and services
michaelherold
245
12k
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.