Commitji is a tool to create conventional commits with gitmojis! Using conventional commits allows us to create CHANGELOG or releases in a standard way but with emojis!
In this article, we will discuss on how to use it on VSCode. If you aren’t using VSCode, the CLI is already in WIP. Maybe that will help you 😄
🚀 Get Started
To get started, install the extension from the VSCode marketplace. You can click here to get it.
Once it is installed, you can now see it on your list of extensions.
To verify that it is correctly installed, check it on the command palette by pressing cmd
+ shift
+ p
and search for “commitji”.
Once you see that on your command palette, it means it’s installed properly. Time to get started!
👨💻 Creating Commitji Message
To create your commit message, execute the command from the command palette, and answer the following prompts.
By default, that workflow that will be used is called Basic Workflow. The Basic Workflow will ask you for the following:
- Commit Type — The list here is inspired by the Angular Conventional Commits.
- Commit Message — Allows you to explain what did you on your task.
After providing your commit message, it will now copy the message on your clipboard (so you can command
+ v
) and try to send it to your terminal if there’s an active one. Otherwise, it will prompt you about it and you still have your commit message on the clipboard.
Here’s a sample result from the Basic Workflow:
$ git commit -m "🐛 - fix: Fixed displaying of user name"
⚙️ Configuring Commitji
Commitji offers right now some flexibility to support different needs. This will change sooner or later when a lot of people started using it on their workflow too.
If you head on to the settings of your VSCode, you can search for “Commitji” or “commitji” and you will see this.
The first setting that we will discuss is the selection of workflows. Commitji offers Basic Workflow and Jira Workflow as of the moment.
Workflow Selection
- Basic Workflow will ask you what commit type and commit message you want to include. You can see the example above.
- Jira Workflow will ask you what commit type, Jira Issue Key/Number, Commit Message, and Jira Workflow Transition (optional). This workflow helps you achieve smart commits by Jira.
Commit Formatting
By default, Commitji uses its preferred commit format
- Basic Workflow Commit Format:
{{unicode}} - {{commitType}}: {{commitMessage}}
$ git commit -m "🐛 - fix: Fixed displaying of user name"
- Jira Workflow Commit Format:
{{unicode}} - {{commitType}}: {{issueKey}} {{commitMessage}} {{workflowTransitionName}}
$ git commit -m "🐛 - fix: [ABC-123] Fixed displaying of user name #code_review"
If you wish to modify this, you can change the format of the settings as well. Here are the corresponding key bindings:
- Unicode:
{{unicode}}
- This one is for the emoji - Commit Type:
{{commitType}}
- Commit Message:
{{commitMessage}}
- Jira Issue Key:
{{issueKey}}
- Jira Workflow Transition Name:
{{workflowTransitionName}}
To show an example, let’s use the Basic Workflow and say we want to move our emoji at the end after the commit message. We can do so by doing the following:
I moved the {{unicode}}
binding at the end and the result is this:
$ git commit -m "fix: Fixed displaying of user name 🐛"
You can configure it to anything you want as long as the right bindings are there.
Jira Workflow Settings
To use the Jira Workflow, make sure it is selected on the workflow selection.
Jira Workflow example without workflow transition:
Since workflow transition prompt question is optional, you can skip it by pressing esc
.
Jira Workflow example with workflow transition:
If you wish to enable the Jira Workflow Transition, toggle the option Allow Workflow Transition prompt
and you must provide an array of workflow transitions in the settings.
"commitji.jira.workflowTransitions": [
{
"key": "open",
"label": "Open",
"workflowTransitionName": "#open"
},
{
"key": "done",
"label": "Done",
"workflowTransitionName": "#done"
}
]
For more details about the workflowTransitionName
check out this Jira documentation.
🤖 Bringing It All Together
Commitji is actually not just for conventional commits. Commitji can expand to other workflows in the future. This is just the start of it and I’m happy to share it with you. If you have any ideas or you’d like to contribute, provide an issue, or propose feature requests, please do so! I would love that ️❤️ Thank you for reading. Hope this will help you on your journey!