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
Package Traits
ikesyo
1
210
functionalなアプローチで動的要素を排除する
ryopeko
1
220
ErdMap: Thinking about a map for Rails applications
makicamel
1
670
カンファレンス動画鑑賞会のススメ / Osaka.swift #1
hironytic
0
170
ゼロからの、レトロゲームエンジンの作り方
tokujiros
3
1.1k
HTML/CSS超絶浅い説明
yuki0329
0
190
知られざるDMMデータエンジニアの生態 〜かつてツチノコと呼ばれし者〜
takaha4k
1
460
Simple組み合わせ村から大都会Railsにやってきた俺は / Coming to Rails from the Simple
moznion
3
2.2k
情報漏洩させないための設計
kubotak
5
1.3k
サーバーゆる勉強会 DBMS の仕組み編
kj455
1
300
CQRS+ES の力を使って効果を感じる / Feel the effects of using the power of CQRS+ES
seike460
PRO
0
240
テストコード書いてみませんか?
onopon
2
340
Featured
See All Featured
Automating Front-end Workflow
addyosmani
1366
200k
RailsConf 2023
tenderlove
29
970
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.5k
Fireside Chat
paigeccino
34
3.1k
The Language of Interfaces
destraynor
155
24k
Producing Creativity
orderedlist
PRO
343
39k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.3k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
10
870
Typedesign – Prime Four
hannesfritz
40
2.5k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
49
2.2k
Designing on Purpose - Digital PM Summit 2013
jponch
116
7.1k
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.