remote_hooks 1.0.0
remote_hooks: ^1.0.0 copied to clipboard
A CLI tool to share & install git hooks from remote repository
Getting Started #
Add remote_hooks
to your project's dev_dependencies
:
dart pub add dev:remote_hooks
Then, interact with it inside your project using:
dart run remote_hooks -h
Alternatively, install it globally:
dart pub global activate remote_hooks
Once installed globally, you can use it anywhere:
remote_hooks -h
Features #
Store Git hooks in a shared repository to ensure consistency and reusability across team members and multiple projects.
Usage #
Hooks installation #
Usage: remote_hooks install [arguments]
-h, --help Print this usage information.
-u, --url Url to the remote repository
-r, --ref Repository ref to checkout
For example you can this command to install hooks from remote repository
remote_hooks install -u git@github.com:SilentCatD/where-you-store-hooks.git
Specify ref
to switch branch or checkout a specific commit, this help with different hooks for
different projects
Hooks uninstall hooks #
To uninstall, use:
remote_hooks uninstall
Configuration #
You can also store the information about url
and ref
in a config file.
At the root of your repository, create a remotehooks.yaml
file, inside you can specify these 2
keys:
git-url: git@github.com:SilentCatD/where-you-store-hooks.git
ref: develop
Hooks repository structure (Remote repository) #
Contents of the remote hooks repository will be copied to .git/hooks
, in the remote repository,
you can add a .hooksignore
to exclude files and folders from being copied.
Patterns defined inside .hooksignore
and .gitignore
will be merged together to create a final
exclusive list of patterns.
File extension of files at the root level is not important, as they will be omitted when copying
Example of a repository structure for pre-commit
and pre-push
with hooks written in python
├── .gitignore
├── .hooksignore
├── hooks_utils
│ ├── formatter_utils.py
│ └── printer_utils.py
├── pre-commit.py
└── pre-push.py
Additional information #
For additional command details, use remote_hooks -h
remote_hooks <command> -h