Conventional Commits for VS Code
Conventional Commits is a specification for writing standardized git commit messages. This article is about how to use conventional commits conveniently in Visual Studio Code.
About Conventional Commits
Conventional Commits is an open and free specification hosted on GitHub, that describes how to write a standardized commit message.
There are a number of types of changes, for example a fix, a feature or a test. Then you can specify an optional scope. After that, you describe your changes. In case there are breaking changes, you write in capital letters "BREAKING CHANGE" or an exclamation mark (!) after the type.
An example for a message would be:
fix(UI Widget): corrected minor typos in code
see the issue PROJ-34 for more information
Why Use Conventional Commits
The Conventional Commits website states these five reasons for using Conventional Commits:
- Automatically generating CHANGELOGs.
- Automatically determining a semantic version bump (based on the types of commits landed).
- Communicating the nature of changes to teammates, the public, and other stakeholders.
- Triggering build and publish processes.
- Making it easier for people to contribute to your projects, by allowing them to explore a more structured commit history.
Conventional Commits in VS Code
Always thinking about the right structure for the commit message might be a bit hard. Therefore, there exists an extension for Visual Studio Code that makes the life easier for authors of Conventional Commit messages.
The extension is aptly named Conventional Commits for VSCode.
It has a number of great features including entering the scope and a detailed message. Furthermore, you can include gitmojis which are a nice-to-have.
The extension is easily reachable in the source control view, right next to the commit button. When clicking on the Conventional Commits button, you see a wizard dialog where you can conveniently select among a number of options.
The first part is the type of change you want to commit (like a fix, a feature or a documentation among other possibilities). Next you can type an optional scope of the change. Then optionally select a visual gitmoji.
The next step is important because you have to type a short and tense description of the change. After that, you can optionally type a longer description and then list the breaking changes if you have any.
At the end of the wizard, you can see your composed message in the git commit message text field. If you like, you can fix any errors you might have made and then commit the change to source control.
Conventional Commits are a good way to standardize commit messages across your team for easier git message processing. The Conventional Commits Visual Studio Code extension makes it easy for the developer to write messages in this format. It is worth checking out.
Conventional Commits Spec: https://www.conventionalcommits.org
Conventional Commits for VS Code extension: https://marketplace.visualstudio.com/items?itemName=vivaxy.vscode-conventional-commits
This work is licensed under a Creative Commons Attribution 4.0 International License.