1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/sh
# A hook called by `git commit` to adjust the commit message right before the user sees it
##########################################################################################
#
# This script is called by `git commit` after commit message was initialized and right before
# an editor is launched.
#
# It receives one to three arguments:
#
# $1 - the path to the file containing the commit message. It can be edited to change the message.
# $2 - the kind of source of the message contained in $1. Possible values are
# "message" - a message was provided via `-m` or `-F`
# "commit" - `-c`, `-C` or `--amend` was given
# "squash" - the `.git/SQUASH_MSG` file exists
# "merge" - this is a merge or the `.git/MERGE` file exists
# "template" - `-t` was provided or `commit.template` was set
# $3 - If $2 is "commit" then this is the hash of the commit.
# It can also take other values, best understood by studying the source code at
# https://github.com/git/git/blob/aa9166bcc0ba654fc21f198a30647ec087f733ed/builtin/commit.c#L745
#
# The following example
#
# To enable this hook remove the `.sample` suffix from this file entirely.
COMMIT_MSG_FILE=
# Check if the commit message file is empty or already contains a message
if [; then
# If the commit message is already provided, exit without making any changes.
# This can happen if the user provided a message via `-m` or a template.
fi
# Retrieve the branch name from the current HEAD commit
BRANCH_NAME=
# Generate a default commit message based on the branch name
DEFAULT_MSG=""
# Set the commit message that will be presented to the user.