March 28th 1 PM ET
Free Workshop: Escape the chaos of context-switching

Git Integration for Jira Self-Managed (Data Center/Server) Documentation

Smart commits — Basic commands

There are smart commits commands that you can use in your commit messages. Read on to learn more details on each smart commit command and how they work.

#comment

This command works both in Jira Server/Cloud.

The #comment command will add a comment to a Jira issue.

Syntax: ISSUE_KEY #comment [your comment text]

Examples:
GIT-264 #comment Resolved conflicts.
GIT-1720 #comment Plugin version change from 2.8.2 to 2.8.3. Build number change from 69 to 70.

The above examples will add the specified comment text against the Jira issues.

The committers’ email address in the git configuration must match with the email address of the corresponding Jira user (or vice versa) to comment on issues.

 

#time

This command works both in Jira Server/Cloud.

The #time command will record time tracking information against a Jira issue.

Syntax: ISSUE_KEY #time [Some amount in Jira time syntax] [Your worklog comment text]

Examples:
GIT-264 #time 1w 6d 13h 52m Total work logged.
GIT-1720 #time 1h 20mMerged to master. Released to marketplace.`

The above examples will add the respective time and worklog comment text against the Jira issues.

The Jira time tracking feature allows users to log the length of time spent working on issues. Jira administrators must have enabled this feature for this smart commit to work.

 

#<transition-name>

This command works both in Jira Server/Cloud.

The Jira user must have the appropriate project permissions to be able to transition issues.

The #<transition-name> command will move the Jira issue to a particular workflow state.

Syntax: ISSUE_KEY #<transition-name> [Your commit comment text]

Examples:
GIT-264 #code-review For review.
GIT-1720 #close Closing ticket. #comment Tasks completed.

1 – The first example will transition the Jira issue to the specified workflow state and adds the comment message to the commit.

2 – The second example will transition the Jira issue to the specified workflow state, adds the comment “Closing ticket” to the Comment tab and adds the specified comment, “Task completed“, to the mentioned Jira issue.

With Example #2
For Jira Server/DC, only the mentioned #comment text is added to the Commits tab.

For more information on transitions and workflow names and how they work, see Workflow Transitions.

 

#assign

This command works both in Jira Server/Cloud.

The #assign command will assign the particular issue to the specified Jira user.

Syntax: ISSUE_KEY #assign [Jira username or email of Jira user]

Examples:
GIT-1925 #assign johnsmith
GIT-1961 #assign [email protected]

 

#fixversion

This command only works in Jira Server. It does not work in Jira Cloud.

The #fixversion command will add a Fix Version/s details tag to the specified issue.

Syntax: ISSUE_KEY #fixversion [project version]

Examples:
GIT-1628 #fixversion 2.9.6
GIT-1628 #fixversion 2.9.5 #fixversion 2.9.6

  • The first example adds fix version tag 2.9.6 to the issue, GIT-1628.

  • The second example adds fix version tags 2.9.5 and 2.9.6 to the issue, GIT-1628.

    If there was an initial Fix Version tag on the specified issue, a #fixversion command will append the new Fix Version tag to it.

    For instance:
    The Fix Version tag, 2.9.4, already exists in issue GIT-1254.

    Performing the smart commit, GIT-1254 #fixversion 2.9.5, will give a result of:   Fix Version/s: 2.9.4, 2.9.5

#affectsversion

This command only works in Jira Server. It does not work in Jira Cloud

The #affectsversion command will add an Affect Version/s details tag to the specified issue.

Syntax: ISSUE_KEY #affectsversion [project version]

Example:
GIT-1582 #affectsversion 2.9.6

The #affectsversion command works the same way as #fixversion. However, it appends Affect Version/s tag instead to the specified issue.

 

#label

This command works both in Jira Server/Cloud.

Already available in Jira Cloud
v3.5+ Available in Jira Server

The #label command will add a new label to a Jira issue. If more than one Jira issue is referenced, the labels are added to all mentioned Jira issues. Multiple labels can be created by putting spaces between words.

Syntax: ISSUE_KEY(S) #label [label1] .. [labeln]

Examples:
GITCL-443 #label bucketbreakfix bucketenhancement
GITCL-443 GITCL-247 GITCL-214 #label [email protected] [email protected] requested-feature new-feature #comment Return email when implemented

 


Prev: Smart commits (index)

Next: Smart commits – Advanced examples

Have feedback about this article? Did we miss something? Let us know!
On this page