diff --git a/extensions/git/src/commands.ts b/extensions/git/src/commands.ts index 07e7594aa6b96cb600d8693737413745a4a6b7bc..ddcb91699e0e82d9c8750c4a9930e6955b7b2cf7 100644 --- a/extensions/git/src/commands.ts +++ b/extensions/git/src/commands.ts @@ -996,10 +996,18 @@ export class CommandCenter { return message; } + const getPreviousCommitMessage = async () => { + //Only return the previous commit message if it's an amend commit and the repo already has a commit + if (opts && opts.amend && repository.HEAD && repository.HEAD.commit) { + return (await repository.getCommit('HEAD')).message; + } + }; + return await window.showInputBox({ value: opts && opts.defaultMsg, placeHolder: localize('commit message', "Commit message"), prompt: localize('provide commit message', "Please provide a commit message"), + value: await getPreviousCommitMessage(), ignoreFocusOut: true }); };