smart_commits

Smart Commit commands

The basic syntax for a Smart Commit message is:

<ignored text> <ISSUE_KEY> <ignored text> <COMMAND> <optional COMMAND_ARGUMENTS>

Any text between the issue key and the command is ignored. There are three commands you can use in your Smart Commit messages:

  • comment

  • time

  • transition

Comment

Description

Adds a comment to a Jira Software issue.

Syntax

Example

Notes:

The committer's email address must match the email address of a single Jira Software user with permission to comment on issues in that particular project.

Time

Description

Records time tracking information against an issue.

Syntax

Example

Notes:

This example records 1 week, 2 days, 4 hours and 30 minutes against the issue, and adds the comment Total work logged in the Work Log tab of the issue.

  • Each value for w, d, h and m can be a decimal number.

  • The committer's email address must match the email address of a single JIRA Software user with permission to log work on an issue.

  • Your system administrator must have enabled time tracking on your JIRA Software instance.

Workflow transitions

Description

Transitions a Jira Software issue to a particular workflow state.

Syntax

Example

Notes:

This example executes the close issue workflow transition for the issue and adds the comment Fixed this today to the issue. Note that the comment is added automatically without needing to use the comment command.

You can see the custom commands available for use with Smart Commits by visiting the JIRA Software issue and seeing its available workflow transitions:

  1. Open an issue in the project.

  2. Click View Workflow (near the issue's Status).

The Smart Commit only considers the part of a transition name before the first space. So, for a transition name such as finish work, then specifying #finish is sufficient. You must use hyphens to replace spaces when ambiguity can arise over transition names, for example: #finish-work.

If a workflow has two valid transitions, such as:

  • Start Progress

  • Start Review

A Smart Commit with the action #start is ambiguous because it could mean either of the two transitions. To specify one of these two transitions, fully qualify the transition you want by using either #start-review or #start-progress.

  • When you resolve an issue with the #resolve command, you cannot set the Resolution field with Smart Commits.

  • If you want to add a comment during the transition, the transition must have a screen associated with it.

  • The committer's email address must match the email address of a single JIRA Software user with the appropriate project permissions to transition issues.

Advanced examples

Multiple commands on a single issue

Syntax

Commit message

Result

Logs 2 days and 5 hours of work against issue JRA-123, adds the comment 'Task completed ahead of schedule', and resolves the issue.


Multiple commands over multiple lines on a single issue

Syntax

Commit message

Result

Adds the comment 'Imagine that this is a really, and I', but drops the rest of the comment. The work time of 2 days and 5 hours is not logged against the issue because there is no issue key for the time command in the second line. That is, each line in the commit message must conform to the Smart Commit syntax.

This example would work as expected if set out as:


A single command on multiple issues

Syntax

Commit message

Result

Resolves issues JRA-123, JRA-234 and JRA-345.

Multiple issue keys must be separated by whitespace or commas.

Multiple commands on multiple issues

Syntax

Commit message

Result

Logs 2 days and 5 hours of work against issues JRA-123, JRA-234 and JRA-345, adds the comment 'Task completed ahead of schedule' to all three issues, and resolves all three issues.

Multiple issue keys must be separated by whitespace or commas.

Last updated