2

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?

DeGriz
  • 178
  • 1
  • 13
  • 1
    Actually you are right, this my question is a duplicate of other question, but I searched for it both with Google's and Stackoverflow's search engines and didn't find it (maybe because I didn't know the correct name for '#' letter). – DeGriz May 13 '14 at 08:47

1 Answers1

4

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.

Community
  • 1
  • 1
hek2mgl
  • 133,888
  • 21
  • 210
  • 235