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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Joseph Hsu
April 14, 2012
Programming
700
5
Share
Git Hooks: How to Make Friends
Joseph Hsu
April 14, 2012
More Decks by Joseph Hsu
See All by Joseph Hsu
Ruby 2.0
jhsu
3
230
API Versioning
jhsu
1
1.4k
Other Decks in Programming
See All in Programming
Swiftのレキシカルスコープ管理
kntkymt
0
210
フロントエンドとバックエンドで「1文字」を揃えよう
youkidearitai
PRO
0
180
TAKTでAI駆動開発の品質を設計する
j5ik2o
6
810
AI 時代のソフトウェア設計の学び方
masuda220
PRO
29
12k
密結合なバックエンドから TypeScript のコードを生成する
kemuridama
1
700
代数的データ型って何が嬉しいの? #frontend_phpcon_do
kajitack
8
3.1k
さぁV100、メモリをお食べ・・・
nilpe
0
130
脅威をエンジニアリングの糧にして――現場編 / Turning Threats into Engineering Fuel — Field Edition
nrslib
0
250
Lemonade + Foundry Toolkit でお手軽アプリ開発
seosoft
1
270
ユニットテストの先へ:テスト技法で要求・仕様を整理するJava開発実践 / Beyond_Unit_Testing_Practical_Java_Development_Techniques_for_Organizing_Requirements_and_Specifications
shimashima35
0
350
気づいたらRubyで100作品 ー クリエイティブコーディングが生活の一部になるまで / 100 Ruby Sketches Later: How Creative Coding Became Part of My Life
chobishiba
3
540
Claspは野良GASの夢をみるか
takter00
0
160
Featured
See All Featured
Building Flexible Design Systems
yeseniaperezcruz
330
40k
How Software Deployment tools have changed in the past 20 years
geshan
0
34k
Information Architects: The Missing Link in Design Systems
soysaucechin
0
960
Rails Girls Zürich Keynote
gr2m
96
14k
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
550
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
2
1.5k
Fireside Chat
paigeccino
42
3.9k
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
530
Ethics towards AI in product and experience design
skipperchong
2
300
Google's AI Overviews - The New Search
badams
0
1k
The Mindset for Success: Future Career Progression
greggifford
PRO
0
350
Rebuilding a faster, lazier Slack
samanthasiow
85
9.5k
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.