2

Is it possible to change the part:

# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
# On branch master
# Changes to be committed:

To say:

# Staged:
me_and
  • 15,158
  • 7
  • 59
  • 96
Christian Mikkelsen
  • 1,661
  • 2
  • 19
  • 44

2 Answers2

6

Yes, using a prepare-commit-msg hook. This is a script in .git/hooks/ which is run between Git's generation of the commit message, and the commit message being opened in your editor.

As a simple example, copy the below text into a new file called prepare-commit-msg in .git/hooks/.

#!/bin/sh
sed -i '0,/# Changes to be committed:/c# Staged:' "$1"

If you find it doesn't work immediately, check it's executable: run chmod +x .git/hooks/prepare-commit-msg.

(The script is a sed one-liner to replace every line up to and including the "Changes to be committed" line with the text "# Staged:")

me_and
  • 15,158
  • 7
  • 59
  • 96
0

In an easy way, just that part, no.

But you could use the commit-msg hook to modify the commit msg.

Peter van der Does
  • 14,018
  • 4
  • 38
  • 42