The messages template from commit.template
is for new commits only. Because of that it isn't used when I do git merge --squash mybranch && git commit -a
.
Is there something like merge.template
or another solution where I can modify the default message that is presented to me in the editor when doing a merge?
What I see in a usual commit
This opens up in the editor of my choice when doing git commit -a
:
This is my commit message template set via "git config commit.template".
# Bitte geben Sie eine Commit-Beschreibung für Ihre Änderungen ein. Zeilen,
# die mit '#' beginnen, werden ignoriert, und eine leere Beschreibung
# bricht den Commit ab.
#
# Auf Branch main
# Ihr Branch ist auf demselben Stand wie 'origin/main'.
#
# Zum Commit vorgemerkte Änderungen:
# geändert: README.md
#
# Unversionierte Dateien:
# my-commit-msg-tempalte
What I see after git merge --squash
This comes up in the editor of my choice when doing git merge --squash myfix && git commit -a
. The template message is not there!
Squashed commit of the following:
commit 9474d601e6b3ed33efc432f623c08e7931095ba0
Author: buhtz <c.buhtz@posteo.jp>
Date: Mon Mar 13 09:22:33 2023 +0100
commit three
commit 2f6524da10a6c3fba8963761abcd3b5ba3d19f12
Author: buhtz <c.buhtz@posteo.jp>
Date: Mon Mar 13 09:22:25 2023 +0100
commit two
commit 5520ea8e2e75a29e06322a742a4b40dbbb74b3ee
Author: buhtz <c.buhtz@posteo.jp>
Date: Mon Mar 13 09:22:17 2023 +0100
commit one
# Bitte geben Sie eine Commit-Beschreibung für Ihre Änderungen ein. Zeilen,
# die mit '#' beginnen, werden ignoriert, und eine leere Beschreibung
# bricht den Commit ab.
#
# Auf Branch main
# Ihr Branch ist 1 Commit vor 'origin/main'.
# (benutzen Sie "git push", um lokale Commits zu publizieren)
#
# Zum Commit vorgemerkte Änderungen:
# geändert: README.md
# geändert: spiel.py
#
# Unversionierte Dateien:
# my-commit-msg-tempalte
What I would like to have
After doing git merge --squash myfix && git commit -a
I would like my editor comes up with something like this where the template is present. The squash commit message is a nice to have but not mandatory for me.
This is my commit message template set via "git config commit.template".
Squashed commit of the following:
commit 9474d601e6b3ed33efc432f623c08e7931095ba0
Author: buhtz <c.buhtz@posteo.jp>
Date: Mon Mar 13 09:22:33 2023 +0100
commit three
commit 2f6524da10a6c3fba8963761abcd3b5ba3d19f12
Author: buhtz <c.buhtz@posteo.jp>
Date: Mon Mar 13 09:22:25 2023 +0100
commit two
commit 5520ea8e2e75a29e06322a742a4b40dbbb74b3ee
Author: buhtz <c.buhtz@posteo.jp>
Date: Mon Mar 13 09:22:17 2023 +0100
commit one
# Bitte geben Sie eine Commit-Beschreibung für Ihre Änderungen ein. Zeilen,
# die mit '#' beginnen, werden ignoriert, und eine leere Beschreibung
# bricht den Commit ab.
#
# Auf Branch main
# Ihr Branch ist 1 Commit vor 'origin/main'.
# (benutzen Sie "git push", um lokale Commits zu publizieren)
#
# Zum Commit vorgemerkte Änderungen:
# geändert: README.md
# geändert: spiel.py
#
# Unversionierte Dateien:
# my-commit-msg-tempalte