How to make Visual Studio Code remember previous commit messages?
VSCode 1.51 (Oct. 2020) does have a similar feature:
Source Control input box saves commit message history
This addresses a feature request to navigate SCM commit history.
Press
kb(scm.viewPreviousCommit)
andkb(scm.viewNextCommit)
to display the prior and next commits, respectively.
To move directly to the first and last position of the input box, press Alt in conjunction with the corresponding arrow key.Build off of past commit messages and look back in the history without losing your drafted message.
there's an extension that might be interesting for some people:
https://marketplace.visualstudio.com/items?itemName=JanBn.git-last-commit-message
I've just installed it before knowing about @kwood's answer, given that it helped me for a bit , I'm leaving this as a secondary option.
No need for a separate extension or something like that. Git can handle this via commit templates and VSCode supports them already.
For example, assuming you have a unix-like and are in the root of your repository:
echo "My fancy commit message" > .mycommitmsg.txt
git config --local commit.template .mycommitmsg.txt
From there, VSC will automatically use the content of .mycommitmsg.txt.
Second step is to fill this message file with the content of your last commit. That can be achieved with Git hooks, in your case you want the post-commit hook.
Create/edit the file .git/hooks/post-commit
with the following content:
#!/bin/sh
printf "`git log -1 --pretty=%s`" > .gitmessage.txt
Don't forget to make it executable:
chmod +x .git/hooks/post-commit
From there, everything should work as you described. The post-commit hook will automatically fill the message file with the content of your last message and VSC uses the new message as soon as you commit.