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
Register is more than clipboard
satorunooshie
1
340
AsyncSequenceとAsyncStreamのプロポーザルを全部読む!!
s_shimotori
1
220
マンガアプリViewerの大画面対応を考える
kk__777
0
440
Vueのバリデーション、結局どれを選べばいい? ― 自作バリデーションの限界と、脱却までの道のり ― / Which Vue Validation Library Should We Really Use? The Limits of Self-Made Validation and How I Finally Moved On
neginasu
3
1.8k
Researchlyの開発で参考にしたデザイン
adsholoko
0
110
ボトムアップの生成AI活用を推進する社内AIエージェント開発
aku11i
0
1.4k
CSC305 Lecture 12
javiergs
PRO
0
250
外接に惑わされない自システムの処理時間SLIをOpenTelemetryで実現した話
kotaro7750
0
150
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
670
Kotlin 2.2が切り拓く: コンテキストパラメータで書く関数型DSLと新しい依存管理のかたち
knih
0
230
ネストしたdata classの面倒な更新にさようなら!Lensを作って理解するArrowのOpticsの世界
shiita0903
1
230
CSC509 Lecture 10
javiergs
PRO
0
160
Featured
See All Featured
Rails Girls Zürich Keynote
gr2m
95
14k
Build The Right Thing And Hit Your Dates
maggiecrowley
38
2.9k
The Cult of Friendly URLs
andyhume
79
6.7k
Testing 201, or: Great Expectations
jmmastey
46
7.7k
BBQ
matthewcrist
89
9.9k
Imperfection Machines: The Place of Print at Facebook
scottboms
269
13k
Done Done
chrislema
186
16k
Unsuck your backbone
ammeep
671
58k
Side Projects
sachag
455
43k
Building an army of robots
kneath
306
46k
Optimizing for Happiness
mojombo
379
70k
Bash Introduction
62gerente
615
210k
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.