h-rai
h-rai

Reputation: 3974

Capitalise the first letter of the commit message

I'm not a perl user so I'm unsure of how to write a git commit-msg hook script to capitalise the first letter of the message for each commit so that

initial commit

becomes

Initial commit

Upvotes: 1

Views: 1337

Answers (1)

VonC
VonC

Reputation: 1327324

First, a commit-msg hook is generaly used only to validate a commit message, not change it.
You can still try and change the content of the temporary file passed as parameter to that hook.

Second, that hook can be a simple bash sed command:

#!/bin/bash
sed -ie "1 s/\b\(.\)/\u\1/" $1

(see "Uppercasing First Letter of Words Using SED")

Upvotes: 1

Related Questions