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
200
API Versioning
jhsu
1
1.4k
Other Decks in Programming
See All in Programming
FigmaとPHPで作る1ミリたりとも表示崩れしない最強の帳票印刷ソリューション
ttskch
43
19k
Micro Frontends for Java Microservices - Devnexus 2024
mraible
PRO
0
490
二郎系ラーメンのコールで学ぶ AST 解析
memory1994
PRO
7
1.7k
CA.swift19 恋するAIアプリ開発の裏側
oskmr
0
360
#phpcon_odawara オープン・クローズドなテストフィクスチャを求めて / open closed test fixtures
77web
3
230
[技育CAMPアカデミア]アイディアを形に!【超入門】スマホアプリ開発〜リリースまでの流れをご紹介
teamlab
PRO
0
370
Tailwind CSSを本気でカスタマイズする方法
fsubal
13
5.3k
R言語の環境構築と基礎 Tokyo.R 112
bob3bob3
0
270
Blue/Greenデプロイの導入による 運用フローの改善
kudoas
1
380
Elm Form Validation
bkuhlmann
0
510
冗長なエラーログを削減し、スタックトレースを手に入れる / Reducing Verbose Error Logs and Obtaining Stack Traces
upamune
0
690
はてなにおける CSS Modules、及び CSS Modules に足りないもの / CSS Modules in Hatena, and CSS Modules missing parts
mizdra
7
930
Featured
See All Featured
How GitHub (no longer) Works
holman
304
140k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
226
51k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
78
42k
Making Projects Easy
brettharned
108
5.5k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
274
13k
Ruby is Unlike a Banana
tanoku
96
10k
How to Ace a Technical Interview
jacobian
272
22k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
352
28k
Automating Front-end Workflow
addyosmani
1356
200k
The Art of Programming - Codeland 2020
erikaheidi
42
12k
Practical Orchestrator
shlominoach
182
9.7k
Stop Working from a Prison Cell
hatefulcrawdad
266
19k
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.