background

In daily work and life, I come into contact with various task tracking systems, such as Jira and GitHub issue. Then we need to associate the corresponding task in the Git Commit message, so that the subsequent review will be very convenient to understand the background of the change.

This leads to the problem of frequently switching between the development environment and the task management environment during development, and finding information from the task to attach to the Commit message when committing. The user experience is poor.

The solution

I have always wanted to develop a plugin to solve this problem.

At that time, I had the following functions in mind:

  1. You can view the task list in the IDE
  2. The commit message can be automatically generated at commit time based on the task information

Fortunately, I found a function like IDEA before I started to develop it: Task.

Task not only met my two requirements above, but also gave me unexpected surprises:

  1. You can automatically generate a new Git branch and ChangeList when you start working on a new problem, conforming to Git flow
  2. Support not only for Jira, but also for GitHub, Gitlab, Trello and other major apps.

For Example: Github issue

I’ll use GitHub as an example to demonstrate how to configure and use this feature.

Step 1 Connect to GitHub in IDEA

On the menu bar, follow Tools > Tasks & Contexts > Configure Servers to go to the configuration page.

Go to ➕ and select GitHub:

After adding GitHub, this is what it looks like:

Next, follow the prompts on the interface to configure the user/organization name of the repository you want to connect to, as well as the repository name.

For the sake of understanding, let’s take one of my warehouses as an example

  • T-OnerisRespository Owner
  • VaiPixelisRespository Name

There are ALSO API tokens, which you can either use your existing tokens or click Create API Token to Create one.

After making sure everything is filled in correctly, click OK to save it. At this point, if all the configuration information is correct, you are ready to connect to GitHub.

Step 2 Browse the issue

Contexts & Contexts > Open Task You can also press the shortcut option + Shift + N (Alt + Shift + N for Windows users) to pull up the page.

The third step starts working on an issue

When we want to start working on a problem, select a problem from the issue list and double-click to open it:

On this page you can configure the status of the issue, whether or not to create a new Changelist, the name of the new Git branch, and so on. Of course, if you don’t have a lot of requirements for naming, you can use the default configuration.

After selecting an issue, the local will switch directly to the new Git branch and activate the corresponding Changelist.

Step 4 Configure the Commit Message template

Although the previous operations can be very convenient, but there is a big story to say. That is to generate a COMMIT message based on the issue information, like this:

How do you configure it? Remember the Github page from step 1?

The page to fill in the configuration has a Tab called Commit Message:

You can write your own template by clicking Add Commit Message. The input box is prompted with a magic value variable, which will be automatically generated based on the selected issue:

SpendTogether-1 [Feature] Complete add bill select member fix# 1
Copy the code

After this submission, both the standard log and the issue can be closed after THE PR passes. The key is not to switch back and forth their own copy and paste, is not very comfortable 😆.

The last

I’m just demonstrating the GitHub configuration, but others, like Jira, are similar, so you can explore them for yourself 🤪

Welcome to follow my public account ~