Skip to content

juliamae/githooks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

githooks

These are the git hooks I use. Drop them into your repo's .git/hooks directory if you feel like it, or make the hooks global for all your projects.

commit-msg

This prepends every commit message with the current branch description, after the commit message is set. I use a GitHub emoji code to describe each branch.

My master branch description for this repo is ⚓, and so:

$ git add commit-msg prepare-commit-msg
$ git commit -m "Add commit-msg and prepare-commit-msg hooks."
[master ee64377] :anchor: Add commit-msg and prepare-commit-msg hooks.
 2 files changed, 31 insertions(+)

prepare-commit-msg

This hook modifies the default commit message that is presented in editor before the message is saved. It currently modifies default merge commit message to make it snazzier.

$ git merge origin/branch-i-want

will produce the default message:

:part_alternation_mark:erge 'origin/branch-i-want' into this fine-ass branch right here

Making hooks global

To make hooks global for all your projects:

$ git config --global init.templatedir '~/.git-templates'
$ git clone https://github.com/juliamae/githooks ~/.git-templates

Any newly initialized repo will have the hooks. To add them to an existing repo:

$ cd ~/code/repo_madness # Your existing repo.
$ git init

About

Fun with git hooks

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages