9

I know, with command line I can do this:

git commit -m "Title" -m "Description .........."

Is there way to do this via Git Version Control in VS Code?

MAx Shvedov
  • 195
  • 5
  • 13

2 Answers2

17

First, people are often misunderstanding what this command actually does. It is important to know what happens behind the scene.

So, this is from the git commit documentation:

If multiple -m options are given, their values are concatenated as separate paragraphs.

Therefore when providing a commit message in Team Explorer, try separating your title from your description in separate paragraphs and it should have the same behavior as your command-line example.

This command is not as magic as it seems. To see a live implementation. see this answer which really shows it well.

scharette
  • 9,437
  • 8
  • 33
  • 67
12

Is there way to do this via Git Version Control in VS Code?

Absolutely!
In VS code you can create messages and descriptions without using the command-line at all.

I discovered this by reading about commit messages from the command line as noted in the link above.  If the message contains more than one paragraph of text, subsequent lines/paragraphs become the description.  So, I decided to try this using the commit message window in VS Code and it worked!

Summary
When you create your commit and you type in the commit message, simply hit the enter key a couple of times and then begin adding details. The first line becomes the commit "message" and any subsequent paragraphs of text become the commit's description.

Example:
I created a text file and committed it to my current project with some explanatory text.

This is a detail view from within VS Code showing how to create a commit message with additional descriptive details:

View showing multi-line commit message

Oops! I forgot something - adding additional text before the commit.

Here I have added an additional line of text showing that the "detail" part of the commit can have multiple paragraphs.

Second view from within VS Code showing multiple paragraph description

Once the commits are done and pushed (to GitHub in my case), you can go there and view the results.

This is the view of the commit overview from within GitHub: Commit overview in GitHub showing the commit message

And this is the way the commit message and commit message details look when you click on the message in the overview: This is the commit message detail within GitHub

There's an additional very interesting feature I stumbled across by accident:
If you mouse-over the commit message within GitHub, it shows a tool tip with the message and message details on the summary page! Commit message overview showing tool tip with descriptive text

Jim JR Harris
  • 413
  • 1
  • 6
  • 15