This is an alternative git template folder, actually it only contains special hooks, but might change in the future.
The hooks can contain different implementations.
Which hooks implementation to use set the HOOKS environment variable.
Eg. To select empty hooks, then: on the command line:
HOOKS=empty git ...If HOOKS is undefined, then the default implementation is used.
Contains no hooks - and will newer contain any hooks.
empty implementation is empty. It is for selecting No hooks at all.
The only hook this implementation contain is commit-msg and git-lfs related hooks (autogenerated).
default are for prefix first line with a commit message with the branch that the commit is made on.
Further an optional ID for the host the commit is created on can be included.
Add hostId (optional) and branch to the beginning of the first line of commit messages.
The id have this form:
'branch'[@host_id]:
Where
‘branch’ is the name of the branch.
- If ‘branch’ is ‘master’ only m is printed (no ”)
- If no branch a - is printed (no ”)
- Else the branch name in ” is printed
[@host_id] ”@host_id” is optional
(included if GIT_HOOKS_HOST_ID is set) [] just shows that it is
optional.
The @ is prepended to the content in GIT_HOOKS_HOST_ID.
The commit-msg hook implements the above functionality.
The prepare-commit-msg calls commit-msg hook if it is a merge. This is done since commit-msg hook is not (always?) run during commit of merges.
Set environment variable GIT_HOOKS_ROOT to the root of this package -
this folder.
Set environment variable GIT_HOOKS_HOST_ID if you want to include
a host ID, e.g. hostname:
export GIT_HOOKS_HOST_ID=`hostname`Add the following code to ~/.gitconfig:
[init]
templatedir = /path/to/slbs-git-template/template
Note: The templates does not include a description file, like normal templates does, this is to prevent overwriting repository description files during git init on existing repository.
The default content for .git/description is:
Unnamed repository; edit this file 'description' to name the repository.
- Do the steps in Use the hooks for new git repositories.
- Run git init in each git repository you want to use those hooks.
- Note existing files will not be deleted, but overwritten, e.g. the
This is intended to be a switch to set for single commands where the
hooks is not wanted, then set the variable HOOKS=empty (or any
non-existing impl … but more implementations might come in the
future.
HOOKS=empty git ...License: GNU General Public License, version 2