Question

I have a little problem. In our company we have an agreement that all commits that related to some issue in bug tracker should start with #<issue_number> (for example, #8956). But git ignores all of the lines that starts with letter '#' when writing message using an editor. If I use git commit -m '#<issue_number> <Message>' there is no problem. But I want to amend commit and edit it's message without using -m flag. So is there a way to make git not to ignore lines starting with # when using editor to write commit message?

Was it helpful?

Solution

You can either commit by passing the commit message via command line:

git commit -m '#1 fixed issue'

If you want to enter the commit message using a text editor you need to keep one space at the beginning of the line before the #.


By default git is using the # as the so called cleanup character. You can change this behaviour by passing a different character:

git commit --cleanup='@'

Thanks @CharlesBailey for this information.


Btw, your company should rethink about the agreement as it breaks the default git workflow.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top