diff --git a/extensions/git/src/git.ts b/extensions/git/src/git.ts index a397664fea4..23a68ca7c16 100644 --- a/extensions/git/src/git.ts +++ b/extensions/git/src/git.ts @@ -1813,6 +1813,12 @@ export class Repository { } cleanupCommitEditMessage(message: string): string { + // If the message is a single line starting with whitespace followed by `#`, just allow it. + if (/^\s*#[^\n]*$/.test(message)) { + return message; + } + + // Else, remove all lines starting with whitespace followed by `#`. //TODO: Support core.commentChar return message.replace(/^\s*#.*$\n?/gm, '').trim(); }