Search
Close this search box.

Link Git Commits to Jira Issues with Smart Commits

Smart commits allow you to link Git commits to Jira issues. Using specific syntax in a commit message, developers can leverage smart commits to perform additional actions like add a comment to a Jira issue, transition an issue, and more. Ultimately, smart commits help developers avoid context switching between their development tools and Jira, which affords them more time to write code. 

Learn How to Use Jira Smart Commits

Smart Commit Prerequisites

Add a Comment to a Jira Issue

Record Time Tracking 

Transition a Jira Issue 

The Benefits of Smart Commits 

Jira Smart Commit Prerequisites

Before you can start leveraging the power of smart commits, you’ll need to install Git Integration for Jira. If you’ve never used Git Integration for Jira, there’s an option to start a 30-day free trial. For the integration to work properly, make sure that the email in your Git config matches the email used for your Jira profile.

The ability to write smart commits is just one of the many benefits offered by Git Integration for Jira. This tool makes it easy for developers to drive Jira with Git, eliminate unnecessary context switching, and keep key stakeholders informed on the status of company objectives. Learn more about Git Integration for Jira.

Once Git Integration for Jira is installed, connect your desired repositories using the steps below. 

  1. From your Jira instance, select Apps from the top navigation bar
  2. From the subsequent dropdown menu, select Git Integration: Manage integrations
  3. Select the Add integration button from the center of the page 
  4. Select Git service integration (Recommended)
  5. Select a repository hosting service like GitHub, GitLab, Bitbucket, etc. depending on your preferred service

Once you’ve established a connection between Jira and your repository hosting service of choice, you can select the individual repositories you want to connect. 

To write a smart commit, begin your commit message with an associated Jira issue key, followed by a `#` and then the command for the action you want to take against the issue. 

Basic Smart Commit Syntax Example

<ISSUE_KEY> <ignored text> #<command> <optional command_params>

Add a Comment to a Jira Issue with a Jira Smart Commit

Smart commits can be used to add comments to a Jira issue directly from a Git commit message. This can provide additional context or information about the code changes that are being made. To do this, developers simply need to include a specific syntax in their commit message that includes the Jira issue number and the comment they want to add. 

Add a Comment Example

ISSUE_KEY #comment text

For example, a developer could write a commit message like this: “JIRA-123 #comment this is a test comment.” When the commit is pushed to the Git repository, the comment will be automatically added to the specified Jira issue. This helps streamline the process of tracking and managing issues, making it easier for team members to stay informed and up-to-date on the progress of a project. 

Record Time Tracking on a Jira Issue with a Jira Smart Commit

Smart commits can also be used to record time tracking information for Jira issues. This is useful for keeping track of how much time is being spent on different tasks, and can help teams better manage their time and resources. To do this, developers simply need to include a specific syntax in their Git commit message that includes the Jira issue number and the amount of time they want to record. 

Record Time Tracking Information Example

ISSUE_KEY #time [in Jira time syntax]

*Jira administrators must have enabled this feature for this action to work

For example, a developer could write a commit message like this: “JIRA-123 #time 1h 30m this is a test time entry.” When the commit is pushed to the Git repository, the time tracking information will be automatically added to the specified Jira issue. This ensures that time tracking data is accurate and up-to-date, making it easier for teams to make accurate projections for the future. 

Transition a Jira Issue with a Jira Smart Commit

Smart commits can also be used to transition Jira issues from one status to another. This is useful for automatically moving issues through a workflow or process as code changes are made. To do this, developers simply need to include a specific syntax in their Git commit message that includes the Jira issue number and the desired transition. 

Transition an Issue Example

ISSUE_KEY #jira workflow status

*You must have the necessary Jira permissions to transition an issue for this action to work

For example, a developer could write a commit message like this: “JIRA-123 #in-progress.” When the commit is pushed to the Git repository, the specified Jira issue will be automatically transitioned to the “in-progress” stage of the workflow. This makes it easier for teams to stay organized and informed on the status of various issues in a project.

The Benefits of Jira Smart Commits

Smart commits help the individual developer eliminate repetitive tasks like copying over commit message information, thus speeding up their workflow. 

Development teams that leverage smart commits are able to keep their commit messages organized and consistent, making it easier to review and understand code changes that have been made. 

Ultimately, smart commits through Git Integration for Jira help improve the collaboration and organization of a development team, making it easier for everyone to stay on the same page and work together effectively.

Visual Studio Code is required to install GitLens.

Don’t have Visual Studio Code? Get it now.

Team Collaboration Services

Secure cloud-backed services that span across all products in the DevEx platform to keep your workflows connected across projects, repos, and team members
Launchpad – All your PRs, issues, & tasks in one spot to kick off a focused, unblocked day. Code Suggest – Real code suggestions anywhere in your project, as simple as in Google Docs. Cloud Patches – Speed up PR reviews by enabling early collaboration on work-in-progress. Workspaces – Group & sync repos to simplify multi-repo actions, & get new devs coding faster. DORA Insights – Data-driven code insights to track & improve development velocity. Security & Admin – Easily set up SSO, manage access, & streamline IdP integrations.
winget install gitkraken.cli