https://github.com/joeapearson/devbox-git-hooks
Git hooks support for devbox
https://github.com/joeapearson/devbox-git-hooks
devbox git-hooks
Last synced: 2 months ago
JSON representation
Git hooks support for devbox
- Host: GitHub
- URL: https://github.com/joeapearson/devbox-git-hooks
- Owner: joeapearson
- Created: 2025-01-30T22:14:08.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-02-09T14:14:03.000Z (10 months ago)
- Last Synced: 2025-10-05T00:58:25.483Z (2 months ago)
- Topics: devbox, git-hooks
- Language: Shell
- Homepage:
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# devbox-git-hooks
A plug-in that integrates git hooks with [devbox], particularly useful for running a `pre-commit` script defined in
devbox.
## Usage
### Installation
Add `"github:joeapearson/devbox-git-hooks"` to your [devbox.json] `include` list.
### Adding hooks
1. Add a script to your [devbox.json] `shell.scripts` map matching the name of the git hook you'd like to invoke devbox. For example, `"pre-commit"`, `"post-commit"` and so on.
2. `.git/hooks` will be checked for an existing hook. If one exists, it'll be left unmodified.
3. If not already existing, a hook will be created, pointing to `devbox run HOOK_NAME`
More information on git hooks is found [here](https://git-scm.com/docs/githooks).
### Removing hooks
1. Remove the entry from `shell.scripts`.
2. Check and delete the associated `.git/hooks/HOOK_NAME`
### Example devbox.json
```json
{
"$schema": "https://raw.githubusercontent.com/jetify-com/devbox/0.13.7/.schema/devbox.schema.json",
"packages": ["shellcheck@latest"],
"shell": {
"scripts": {
"pre-commit": ["shellcheck *.sh"]
}
},
"include": ["github:joeapearson/devbox-git-hooks"]
}
```
Demonstrates how you might use [shellcheck] to lint shell scripts before committing changes.
### CI environments
If `CI` environment variable is set then this plug-in does nothing.
[devbox]: https://www.jetify.com/docs/devbox
[devbox.json]: https://www.jetify.com/docs/devbox/configuration/
[shellcheck]: https://www.shellcheck.net