diff --git a/src/commands/prepare-commit-msg-hook.ts b/src/commands/prepare-commit-msg-hook.ts index 234b6872..903d472d 100644 --- a/src/commands/prepare-commit-msg-hook.ts +++ b/src/commands/prepare-commit-msg-hook.ts @@ -75,7 +75,7 @@ export default () => if (hasMultipleMessages) { if (supportsComments) { instructions += - '# Select one of the following messages by uncommeting:\n'; + '# Select one of the following messages by uncommenting:\n'; } instructions += `\n${messages .map((message) => `# ${message}`) @@ -87,7 +87,10 @@ export default () => instructions += `\n${messages[0]}\n`; } - await fs.appendFile(messageFilePath, instructions); + const currentContent = await fs.readFile(messageFilePath, 'utf8'); + const newContent = instructions + '\n' + currentContent; + await fs.writeFile(messageFilePath, newContent); + outro(`${green('✔')} Saved commit message!`); })().catch((error) => { outro(`${red('✖')} ${error.message}`);