Using Smart Commits in Bitbucket Server

このページの内容

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

Smart Commits allow repository committers to process Jira Software Server issues using special commands in your commit messages.

以下のことが可能です。

  • 課題にコメントする
  • 課題の時間管理情報を記録する
  • transition issues to any status defined in the Jira Software project's workflow.

A single Smart Commit command cannot span more than one line (you cannot use carriage returns in the commit message), but you can add multiple commands to the same line, or multiple commands on separate lines. See this example below.

Smart Commits work with Bitbucket Server 4.2+ and Jira Software Server 7.1+.

On this page:

スマート コミット コマンド

The basic command line 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 smart commit command is ignored.

There are three smart commit commands you can use in your commit messages:

コメント

説明 JIRA Software 課題にコメントを追加する
構文<ignored text> ISSUE_KEY <ignored text> #comment <comment_string>
JRA-34 #comment corrected indent issue
注意
  • コミッターのメールアドレスが、その特定のプロジェクトで課題にコメントする権限を持つ単一の JIRA Software ユーザーのメールアドレスと一致する必要があります。

時間

説明 Records time tracking information against an issue.
構文<ignored text> ISSUE_KEY <ignored text> #time <value>w <value>d <value>h <value>m <comment_string>
JRA-34 #time 1w 2d 4h 30m Total work logged
注意

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

  • wdh および m の値には小数も使用できます。
  • コミッターのメールアドレスが、課題に対する作業を記録する権限を持つ単一の JIRA Software ユーザーのメールアドレスと一致する必要があります。
  • システム管理者があなたの JIRA Software インスタンスの時間管理を有効にしていなければなりません。

ワークフローのトランジション

説明 JIRA Software 課題を特定のワークフロー状態に移行します。
構文<ignored text> ISSUE_KEY <ignored text> #<transition_name> <comment_string>
JRA-090 #close Fixed this today
注意

この例では、課題に対して課題のクローズ ワークフロー トランジションを実行し、コメント「Fixed this today」を課題に追加します。コメントは、#comment コマンドを使用しなくても自動的に追加されることに注意してください。

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. プロジェクト内の課題を開きます。
  2. ワークフローの表示 (課題のステータスの近く) をクリックします。

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.

次のように、ワークフローに2つの有効なトランジションがある場合:

  • 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.
  • トランジション中にコメントを追加したい場合、そのトランジションが関連する画面を持っている必要があります。
  • コミッターのメールアドレスは、課題をトランジションできる適切なプロジェクト権限を持つ単一の JIRA Software ユーザーのメールアドレスと一致する必要があります。

高度な例

単一の課題に対して複数行にわたる複数のコマンド

構文


<ISSUE_KEY> #<COMMAND_1> <optional COMMAND_1_ARGUMENTS> #<COMMAND_2> <optional COMMAND_2_ARGUMENTS> ... #<COMMAND_n> <optional COMMAND_n_ARGUMENTS>


コミット メッセージ

JRA-123 #comment Imagine that this is a really, and I mean really, long comment #time 2d 5h

Result
Adds the comment 'This is a really, and I' (but drops the rest of the comment) and logs 2 days and 5 hours of work against issue JRA-123.

単一の課題に複数のコマンド

構文


<ISSUE_KEY> #<COMMAND_1> <optional COMMAND_1_ARGUMENTS> #<COMMAND_2> <optional COMMAND_2_ARGUMENTS> ... #<COMMAND_n> <optional COMMAND_n_ARGUMENTS>


コミット メッセージ

JRA-123 #time 2d 5h #comment Task completed ahead of schedule #resolve

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.

複数の課題に対して単一コマンドを使用

構文


<ISSUE_KEY1> <ISSUE_KEY2> <ISSUE_KEY3> #<COMMAND> <optional COMMAND_ARGUMENTS> etc 


コミット メッセージ

JRA-123 JRA-234 JRA-345 #resolve

Result
Resolves issues JRA-123, JRA-234 and JRA-345. Multiple issue keys must be separated by whitespace or commas.

複数の課題に対して複数のコマンドを使用

構文


<ISSUE_KEY1> <ISSUE_KEY2> ... <ISSUE_KEYn> #<COMMAND_1> <optional COMMAND_1_ARGUMENTS> #<COMMAND_2> <optional COMMAND_2_ARGUMENTS> ... #<COMMAND_n> <optional COMMAND_n_ARGUMENTS>


コミット メッセージ

JRA-123 JRA-234 JRA-345 #resolve #time 2d 5h #comment Task completed ahead of schedule

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.


Smart Commit の活用

Smart Commits work with Bitbucket Server 4.2+ and Jira Software Server 7.1+.

To get Smart Commits working for Jira Software and Bitbucket Server:

  1. Create an application link between Jira Software and Bitbucket Server. See Linking Bitbucket Server with Jira.
  2. Enable smart commits in Jira Software. See Enabling DVCS Smart Commits.

Some limitations of Smart Commits:

  • Smart Commits only support the default Jira Software issue key format (that is, two or more uppercase letters, followed by a hyphen and the issue number, for example BAM-123).
  • Smart Commits don't provide for field-level updates in Jira Software issues.

  • Note that elevated access rights in Jira Software Server can result from the way that Git (and Mercurial) allow commits to be attributed to a user other than the user pushing a change to the repository. If this seems like a risk for your situation, then you should consider disabling Smart Commits on the Jira Software Server instance.

Last modified on Mar 4, 2019

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.