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
700
5
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
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
スマートグラスで並列バイブコーディング
hyshu
0
260
依存関係から依存物へ―Dependencyという言葉の歴史をひも解く
j_lee
0
140
RTSPクライアントを自作してみた話
simotin13
0
630
ローカルLLMでどこまでコードが書けるか -拡張版 / How much code can be written on a local LLM Extended
kishida
12
4.4k
Performance Engineering for Everyone
elenatanasoiu
0
220
TAKTでAI駆動開発の品質を設計する
j5ik2o
7
1.5k
技術記事、 専門家としてのプログラマ、 言語化
mizchi
13
6.5k
AIだと陥りがちなJakarta EE最新技術への移行時の落とし穴と解決策
tnagao7
0
120
Datadog LLM Observabilityで実現する 安全なLLM Usage 管理
3150
0
110
Observability in Practice:Grafana 與 Edge Device SRE 的那些事
blueswen
0
180
1B+ /day規模のログを管理する技術
broadleaf
0
110
Vue × Nuxt × Oxc どこまで使える?実運用の現在地
andpad
0
300
Featured
See All Featured
Faster Mobile Websites
deanohume
310
32k
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
1
1.8k
HDC tutorial
michielstock
2
720
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
240
Paper Plane
katiecoart
PRO
1
52k
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.3k
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.3k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
220
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
540
Heart Work Chapter 1 - Part 1
lfama
PRO
8
36k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.9k
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
240
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.