This feature provides a set of hooks for working with Git repositories.
"features": {
"ghcr.io/tomgrv/devcontainer-features/githooks:5": {}
}npx tomgrv/devcontainer-features -- add githooks- pre-commit - Runs git-pre-commit to validate the code before committing and lint-staged to lint and format staged files.
- prepare-commit-msg - Runs commitizen to prepare commit messages.
- commit-msg - Runs commitlint to validate commit messages.
- post-merge - Handles changes in package.json and composer.json after a merge.
- post-checkout - Runs git update to update the current branch with the latest changes from the remote.
- pre-push - Runs validate-branch-name to validate the branch name before pushing.
All hooks utilities are installed globally and can be configured in the package.json file.
A default configuration is provided for each utility, but you can override it by modifying the package.json file.
The following hooks are provided:
pre-commit- Executesgit-pre-committo validate the code before committing. It also runslint-stagedto lint and format staged files, ensuring code quality and consistency before changes are committed.prepare-commit-msg- Utilizescommitizento help prepare standardized and conventional commit messages, making it easier to follow commit message guidelines.commit-msg- Runscommitlintto validate commit messages against defined rules, ensuring that all commit messages are consistent and follow the project's conventions.post-merge- Handles changes inpackage.jsonandcomposer.jsonafter a merge, ensuring that dependencies are correctly updated and any necessary post-merge tasks are performed.post-checkout- Executesgit updateto synchronize the current branch with the latest changes from the remote repository, keeping the local branch up-to-date.pre-push- Runsvalidate-branch-nameto ensure that the branch name adheres to the project's naming conventions before pushing changes to the remote repository.
The feature also includes the following VS Code customizations:
-
Extensions:
vivaxy.vscode-conventional-commitssoftwareape.rebasertomblind.scm-buttons-vscode
-
Settings:
conventionalCommits.gitmoji:false
If you have a feature that you would like to add to this repository, please open an issue or submit a pull request.