Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Greater than one line git commit messages

Tags:

git

jira

We are using git with Eclipse (graphic git). Our commit statements have a description and then a Change ID. Our description must have a JIRA story at the beginning.

My problem is I can never have more than one line in the commit or it will complain (see the image below). This is actually just one line but the word "field" wrapped around. You cannot get very descriptive with one line. Does anyone know a way around this?

enter image description here

like image 918
Tony Avatar asked Oct 28 '25 07:10

Tony


2 Answers

While using Eclipse Oxygen.3a Release (4.7.3a) came across this issue.

Found Bug 471421 - Commit message warning in Git Staging View is wrong which contains the suggested work-around which did suppress the warning when entered a title of more than 50 characters:

Unselecting "Hard-wrap commit message" in Team/Git/Committing preferences panel solve the problem.

like image 111
Chester Gillon Avatar answered Oct 30 '25 23:10

Chester Gillon


The Git docs says in git commit (emphasis mine):

Though not required, it’s a good idea to begin the commit message with a single short (less than 50 character) line summarizing the change, followed by a blank line and then a more thorough description. The text up to the first blank line in a commit message is treated as the commit title, and that title is used throughout Git. For example, git-format-patch1 turns a commit into email, and it uses the title on the Subject line and the rest of the commit in the body.

So git itself does handles several "physical" lines up to the first empty line as one "logical" line and displays this e.g. with git log --oneline. Other tools might or might not do that.

Therefore you can just ignore the warning.

like image 29
A.H. Avatar answered Oct 30 '25 23:10

A.H.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!