not sure if you can do this but I am looking for the Syntax / Placement to add a new message when editing a commit via git commit --amend
I am aware that you can overwrite a message via git commit --amend -m '<over write message goes here>'
.
In this case I have some commits that all fall into one batch - they are quick fixes and the aim is to reference there issue numbers on the message so this is shown in gitlabs.
Instead of having X commits per issue, I wanted to write a message like "#22 #24 #26 - batch update of small low level issues".
When I run: git commit --amend
I am greeted with a VIM screen:
Where and how do I add to the current commit message on this page / is this possible?
I tried:
Keycommand: i (allows you to insert)
Then adding to the currently shown commit message at the top:
then
Keycommand: :wq (to write and save)
I get an issue: Aborting commit due to empty commit message.
So where do I need to add the commit message using this system?
thanks - W
Answer
Git ignores lines starting with # so to just call a message # works when it is defined as a message but does not work when re writing a message in VIM
Need to prefix the line with something like
CodePudding user response:
As it says -
Lines starting with '#' will be ignored
so put your commit message on that empty line, below "#24 ..." line.