Skip to content

benjdum59/git-hooks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

git-hooks

The aim of this repository is to store common git hooks. In addition, this repository offers a way to install them locally using only an url.

Simple installation

At the root of your local git repository, run the following command:

wget -O install-git-hooks.sh  https://raw.github.com/benjdum59/git-hooks/master/install.sh ; bash install-git-hooks.sh

Manual installation

Clone/Download the repository and put all the hooks you need in your .git/hooks folder inside your local repository. Copy the conf folder (if exists) and the message folder in your .git/hooks folder inside your local repository.

Advanced use

By default, all hooks will be installed using the simple installation. You can filter them by adding the hook(s) you need as argument. e.g.

wget -O install-git-hooks.sh  https://raw.github.com/benjdum59/git-hooks/master/install.sh ; bash install-git-hooks.sh commit-msg

Hooks description

commit-msg

Force a pattern to apply for commit messages. The pattern used is described in the message/commit-message-format file

prepare-commit-msg

Auto feed the commit message based on the branch name. Branch must be named like <branch type>/<Issue ID> with:

  • branch type: feat | feature | fix | refactor | refacto (Issue ID is mandatory)
  • branch type: chore | docs | doc | style | perf | test | build (Issue ID is optional)
  • issue ID: must start with a letter and end with a digit

To use it, you have to do a git commit with no parameters. It only works with standard editors (like vim if you use git in CLI). Some tools, like Source Tree, do not use standard editor so it won't work.

pre-push

Prevent pushing from develop or master (this should be done in a pull request)

Hooks workflow

Hooks workflow

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages