path: root/templates
diff options
authorKaartic Sivaraam <>2017-07-11 14:30:54 (GMT)
committerJunio C Hamano <>2017-07-12 20:21:07 (GMT)
commit0ef1a4e32a720928a497a13ef08aa8f0a63dc476 (patch)
treeffca643827a7d8163812c804dca663f08255a845 /templates
parente1a4a28373befdce97daf9702f6ab790c9806451 (diff)
hook: add a simple first example
Add a simple example that replaces an outdated example that was removed. This ensures that there's at the least a simple example that illustrates what could be done using the hook just by enabling it. Also, update the documentation. Signed-off-by: Kaartic Sivaraam <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'templates')
1 files changed, 6 insertions, 3 deletions
diff --git a/templates/hooks--prepare-commit-msg.sample b/templates/hooks--prepare-commit-msg.sample
index 87d7705..dc707e4 100755
--- a/templates/hooks--prepare-commit-msg.sample
+++ b/templates/hooks--prepare-commit-msg.sample
@@ -9,20 +9,23 @@
# To enable this hook, rename this file to "prepare-commit-msg".
-# This hook includes two examples.
+# This hook includes three examples. The first one removes the
+# "# Please enter the commit message..." help message.
-# The first includes the output of "git diff --name-status -r"
+# The second includes the output of "git diff --name-status -r"
# into the message, just before the "git status" output. It is
# commented because it doesn't cope with --amend or with squashed
# commits.
-# The second example adds a Signed-off-by line to the message, that can
+# The third example adds a Signed-off-by line to the message, that can
# still be edited. This is rarely a good idea.
+@PERL_PATH@ -i.bak -ne 'print unless(m/^. Please enter the commit message/..m/^#$/)' "$COMMIT_MSG_FILE"
# case "$COMMIT_SOURCE,$SHA1" in
# ,|template,)
# @PERL_PATH@ -i.bak -pe '