-
Notifications
You must be signed in to change notification settings - Fork 249
Enabling Lolcommits for all your Git Repositories
Roman Pertl edited this page Nov 28, 2022
·
7 revisions
You can easily enable lolcommits across all your local Git repos (and any repos you may clone or add in the future). Use git init and the init.templatedir setting to achieve this, like so;
# create a template dir for hooks (if you don't already have one)
mkdir -p ~/.git_template/hooks
# tell git to use this template dir (globally)
git config --global init.templatedir '~/.git_template'
# copy the post-commit hook from any existing lolcommits enabled repo
cp [path/to/lolcommit-enabled-repo]/.git/hooks/post-commit ~/.git_template/hooks/
# navigate to all existing local repos on your machine and run
git initThe template and post-commit hook will be applied to existing repos (and any newly cloned or initialized repos). For more information on git init and the init.templatedir setting take a look at the Git docs.
We prefer to use git templates to achieve this (it's what they are there for). They provide a standard cross-platform way to apply default hooks across multiple repos, and we don't want to reinvent that within the lolcommits gem.
You could also check out this shell script which will enable lolcommits on all git repos within a specific directory.