One-keystroke git commits with Visual Studio Code
Committing changes to git is laborious. First, you view the changes with
git diff, maybe refine the output with advanced options, then
git add the files and finally
git commit the changes. Make a couple of typos on the way, and the keystrokes add up. The efficient developer in you asks: isn't there a better way?
Microsoft has treated developers with Visual Studio Code. It has a git commit mode so well integrated that it deserves a dedicated article.
Integrated git mode
Visual Studio Code solves this problem by providing a simple code editor that includes built-in git integration.
Visual Studio Code, also known as vscode, provides an informative diff view. It shows inline changes well, something that is hard to decipher from the standard
git diff output. Removed and added lines are clearly displayed with green and red indicator colors. You can edit the right pane to make last corrections - but make sure you run tests before committing big changes.
The most common use case of committing all changed files requires writing a commit message and hitting Cmd+Enter. Apart from typing the commit message text itself, that's only one keystroke! Experiencing git commit this easy after the 40-plus characters in the terminal is liberating.
One-keystroke commits allow you commit more often
There are also other features in the git mode, such as selective commits, merging, and syncing with a repository. You can find more about that in the vscode documentation. Using vscode for git commits reduces the amount of keyboard acrobatics and makes you commit more often as a consequence.
Node doesn't wait for your database call to finish?
Learn how asynchronous calls work and make your app run as you intended. Get short email course on asynchronicity and two chapters from Finish Your Node App.