~2 min read|
In his talk “A Branch In Time” (which I wrote about recently in Write Better Commit Messages, Tekin Süleyman has an offhand comment that I haven’t been able to shake: “The command line doesn’t encourage you to write descriptive commit messages.”
Tekin suggested using a code editor instead and provided the code you’d need to make Sublime your default editor. I don’t use Sublime though, and VS Code’s built in Source Control module is actually pretty nice.
None the less, I find the editing experience cramped for commit messages - even after I figured out that you could type multiple lines - and I prefer to manage git from the command line for more fine control over what I’m doing.
Still, if there was an automated way to flip between the command line and VS Code to write a commit message, I’d happily try that. Pawel Sołtysiak wrote a post detailing exactly that!
There’s only one command to run:
git config --global core.editor "code --wait"
Pawel notes that the
--wait flag is to ensure
git waits until the VS Code window is closed before continuing.
He also added a second tip related to
diffs and the
difftool. To use VS Code for diffs, add the following lines to your
[diff] tool = vscode [difftool "vscode"] cmd = code --wait --diff $LOCAL $REMOTE
In the past I haven’t spent a lot of time comparing two diffs like this (relying instead on the VS Code module here), but it’s nice to know how! It’s even nicer when there’s a more ergonomic way to do it.
$ git config --global diff.tool "vscode", I was not able to figure out how to add the second one specifying the
Hi there and thanks for reading! My name's Stephen. I live in Chicago with my wife, Kate, and dog, Finn. Want more? See about and get in touch!