30 lines
1.2 KiB
Markdown
30 lines
1.2 KiB
Markdown
---
|
|
title: Git hooks - yay or nay?
|
|
date: 2024-03-21
|
|
permalink: daily/2024/03/21/git-hooks---yay-or-nay
|
|
tags:
|
|
- software-development
|
|
- git
|
|
cta: ~
|
|
snippet: |
|
|
Are you in favour of Git hooks or not?
|
|
---
|
|
|
|
Many people are very for or against Git hooks - scripts that run automatically on events such as pre-commit and pre-push.
|
|
|
|
Commonly, they are used for running tasks such as altering a commit message or running before committing automated tests and static analysis before pushing a commit.
|
|
|
|
I'm on the fence.
|
|
|
|
I've used them and added support for them to Build Configs, but I don't feel strongly about them.
|
|
|
|
They are awkward to set up (you need to edit the configuration for them to work) and can be easily disabled or bypassed.
|
|
|
|
Some people think it's the Developer's responsibility to run the tasks before pushing changes or that they'll be run in a CI pipeline, so why would they need to be run locally?
|
|
|
|
As I write many small commits and push changes regularly, I can find hooks irritating and prefer to use watchers instead with tools like `watchexec` and `entr`.
|
|
|
|
There are also tools like Captain Hook that are built to manage Git hooks. Maybe, I should investigate it more.
|
|
|
|
What do you think? Are you yay or nay for Git hooks?
|