Sublime Forum

Git commit message red lines: Painful

#1

I find when I am editing a git commit message an intense red background will appear, apparently at random, among the lines being edited.
The reddened line is virtually unreadable, and consequently harrowing to edit.
How can I prevent these red lines from appearing?

0 Likes

#2

Could you upload a screenshot?

0 Likes

#3

Here is a screenshot.

0 Likes

#4

I somehow cannot reproduce it.
image

But I guess the color means invalid. Why do you want to uncomment those modified blocks and doing something like


Reference reading for other people: Use ST as the git commit message editor

0 Likes

#5

I just did what you see to create a quicky example. So please don’t focus on the content of the commit message. The red line appears every time I do a multi-line commit.

0 Likes

#6

So I can reproduce it now.

In short, there should be at least an empty line between the commit title and the message.

I.e., an empty line should be between the red block and the blue block in the following screenshot.

0 Likes

#7

I see what you mean, but having to introduce a blank line to get rid of a red line clearly indicates a bug. What is more, I don’t normally use a title in my commit messages. I just document what files were changed, maybe adding a comment here and there. So now I’ll have to introduce a useless title to deal with the red line bug?

0 Likes

#8

I don’t think so. At least if you use VIM, it’s marked as invalid as well.
image

If there is no empty line in the title, it results in

No matter how you call something a title personally, git treats the first non-empty block as the title (or called subject) and rest lines as the message. I guess a multi-line subject is not recommended.

You don’t have to actually. You can still commit it even if it’s considered as invalid.

3 Likes

#9

I see. It’s a git thing, not an ST thing.

0 Likes

#10

Correction: It’s a Linux dev team standard and NOT a Git thing.

Git is just waiting for a message to commit, it can be absolutely anything. There’s nothing preventing you to do what you were doing and it’s also not invalid, if it really was invalid Git would simply refuse to commit.

Linux development is all done with email exchanges and so they ask that the commit messages follow the same standard used for emails. Yes, that standard of max 80 characters. Or better yet, 50 char title, 72 message. And not all commits there follow this, mostly do, but not all.

But seriously, do follow it. I do, just like many others, because commit messages should be small and extra data should be separated from the title as it makes them much more useful to read and find. Commits are useful for going back and checking what you did that could be introducing bad behaviour now and bad commit messages just break their usefulness.

2 Likes