0

enter image description here

Is there a way to get VS Code to automatically adjust the commit line message to avoid this warning. Otherwise I need to pay attention and press enter when the message appears, every time I write a commit message.

I would want VS Code to automatically press enter for me , I really don't even understand why the warning shows up, never had that issue when using SourceTree UI for example

starball
  • 20,030
  • 7
  • 43
  • 238
Kepol
  • 149
  • 1
  • 8

1 Answers1

3

If you want to just change the threshold for showing the warning, use "git.inputValidationSubjectLength": <N> for the subject line (the first line) and "git.inputValidationLength": <N> for subsequent lines.

If you want to turn the validation off entirely, use "git.inputValidation": "off".

Put these settings in your settings.json file.

The worst that can happen if you have long subject lines for your commit messages is that it will be hard for you and others to quickly know what a commit has changed. Nothing will explode, but you'll probably thank yourself in the future if you make an effort to be concise. See also: Git Commit Messages: 50/72 Formatting.

See also the git docs on the commit command:

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.

starball
  • 20,030
  • 7
  • 43
  • 238
  • Any way vs code can automatically "press enter for me" at the end of the line? @user – Kepol Feb 09 '23 at 08:25
  • 1
    How would it know where _you_ want the end of the input line to be? You have to press enter yourself to tell it. It's a piece of software :P it can't read your mind. Either I'm misunderstanding what you're asking for, or what you're asking for doesn't really "make sense". – starball Feb 09 '23 at 08:27
  • :D Ok thank you for your link and answer, so it seems like the first line should be like some kind of title for the commit, and the following ones should go more in detail. It makes sense now – Kepol Feb 09 '23 at 08:28
  • My fundamental issue is that I just try to group many features and bugs into one commit, I will start committing more frequently and try to summarize those – Kepol Feb 09 '23 at 08:33
  • 1
    @Kepol: yes, more commits is probably the right thing. But if you still end up with multi-issue commits just start the title as `Various things related to foo`, leave a blank line and then list them all individually. Just because a commit *could* (and maybe should) be multiple commits doesn't mean that it's commit message needs to be bad. – Joachim Sauer Feb 09 '23 at 10:13