Dror
Dror

Reputation: 13051

git commit in vscode with the standard template

After running git commit an editor opens and there a template for the commit message:

<empty line where the messgae should come>
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# On branch mybranch
# Your branch is up to date with 'origin/mybranch'.
#
# Changes to be committed:
#       new file:   README.md
#       deleted:    README.rst
#       modified:   foo.txt
#
# Untracked files:
#       bar.txt
#

Then a common practice is to provide a short one-liner, an empty line and a longer optional description of the commit. When using vscode I noticed that git: commit only allows one line message (enter is actually the committing).

Is there some command in vscode which opens a new buffer with the template known from the CLI of git and upon saving(!) of this new buffer the commit will happen?

Upvotes: 1

Views: 10176

Answers (1)

Braca
Braca

Reputation: 2805

There are a few ways to git commit in VS Code:

  1. With empty message box in the source control side bar Git:Commit in Command Palette or clicking Commit check-mark will give you an input box where you can input one line, <enter> commits, that's the situation you are describing.
  2. You can type multi-line message and then commit via Command Palette or check-mark.
  3. From integrated terminal git commit without message will give you template message in your default editor. It's vi usually, but you can configure git to use any editor.

Upvotes: 3

Related Questions