Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Autohook/Autohook
A very, very small Git hook manager with focus on automation
https://github.com/Autohook/Autohook
bash git
Last synced: about 1 month ago
JSON representation
A very, very small Git hook manager with focus on automation
- Host: GitHub
- URL: https://github.com/Autohook/Autohook
- Owner: Autohook
- License: mit
- Created: 2017-02-01T06:39:03.000Z (almost 8 years ago)
- Default Branch: main
- Last Pushed: 2023-10-20T13:44:59.000Z (about 1 year ago)
- Last Synced: 2024-11-02T17:02:20.594Z (about 2 months ago)
- Topics: bash, git
- Language: Shell
- Homepage:
- Size: 31.3 KB
- Stars: 134
- Watchers: 5
- Forks: 20
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE.txt
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
- awesome-git-hooks - Autohook - A very, very small Git hook manager with focus on automation. (Tools)
README
# Autohook
**Autohook** is a very, _very_ small Git hook manager with focus on automation.
It consists of one script which acts as the entry point for all the hooks, and which runs scripts based on symlinks in appropriate directories.
## Example
Let's say you have a script to remove `.pyc` files that you want to run after every `git checkout` and before every `git commit`, and another script that runs your test suite that you want to run before every `git commit`.
Here's the overview of steps:
1. Put `autohook.sh` in `hooks/`.
2. Run it with `install` parameter (e.g., `./autohook.sh install`).
3. Put your scripts in `hooks/scripts/`.
4. Make sure said scripts are executable (e.g., `chmod +x hooks/scripts/delete-pyc-files`, etc.).
5. Make directories for your hook types (e.g., `mkdir -p hooks/post-checkout hooks/pre-commit`).
6. Symlink your scripts to the correct directories, using numbers in symlink names to enforce execution order (e.g., `ln -s $PWD/hooks/scripts/delete-pyc-files.sh hooks/post-checkout/01-delete-pyc-files`, etc.).The result should be a tree that looks something like this:
```
repo_root/
├── hooks/
│ ├── autohook.sh
│ ├── post-checkout/
│ │ └── 01-delete-pyc-files # symlink to hooks/scripts/delete-pyc-files.sh
│ ├── pre-commit/
│ │ ├── 01-delete-pyc-files # symlink to hooks/scripts/delete-pyc-files.sh
│ │ └── 02-run-tests # symlink to hooks/scripts/run-tests.sh
│ └── scripts/
│ ├── delete-pyc-files.sh
│ └── run-tests.sh
├── other_dirs/
└── other_files
```You're done!
## Contributing
Contributions of all sorts are welcome, be they bug reports, patches, or even just feedback. Creating a [new issue](https://github.com/Autohook/Autohook/issues/new 'New Issue') or [pull request](https://github.com/Autohook/Autohook/compare 'New Pull Request') is probably the best way to get started.
Please note that this project is released with a [Contributor Code of Conduct](https://github.com/Autohook/Autohook/blob/master/CODE_OF_CONDUCT.md 'Autohook Code of Conduct'). By participating in this project you agree to abide by its terms.
## License
This software is licensed under the _MIT License_. Please see the included `LICENSE.txt` for details.