Smart Commit を使用する
When you manage your project's repositories in Bitbucket or GitHub, or use Fisheye to browse and search your repositories, you can process your Jira work items using special commands, called Smart Commits, in your commit messages.
以下のことが可能です。
comment on work itemss
record time tracking information against work items
transition work items to any status defined in the Jira project's workflow.
ソフトウェアのレビューに Crucible を使用する場合、ほかにもアクションを利用できます。Crucible ドキュメントの「Smart Commit を使用する」を参照してください。
スマート コミット コマンドは 1 行に収める必要があります (例えば、コマンドではキャリッジ リターンを使用できません) が、詳細な例で示されるように、同じ行に複数のコマンドを追加できます。1 行に複数のコマンドを入れる例は次を参照してください。
スマートコミット コマンド
スマート コミット メッセージの基本的な構文は次のとおりです。
<ignored text> <WORK_ITEM_KEY> <ignored text> #<COMMAND> <optional COMMAND_ARGUMENTS>
Any text between the work item key and the command is ignored.
スマート コミット メッセージでは次の 3 つのコマンドを使用できます。
comment
time
transition
コメント
説明 | Adds a comment to a Jira work item. |
---|---|
構文 |
|
例 | JRA-34 #comment corrected indent work item |
注意 | The committer's email address must match the email address of a single Jira user with permission to comment on work items in that particular project |
GitHub 使用時に関する詳細
The email address in Github must match the email address of a single Jira user with permission to comment on work items in that particular project
スマート コミットが正しく機能するためには、GitHub で [メールアドレスを非公開にする] のチェックをオフにします
時間
説明 | Records time tracking information against an work item. |
---|---|
構文 |
|
例 | JRA-34 #time 1w 2d 4h 30m Total work logged |
注意 | This example records 1 week, 2 days, 4 hours and 30 minutes against the work item, and adds the comment ' |
ワークフローのトランジション
説明 | Transitions a Jira work item to a particular workflow state. |
---|---|
構文 |
|
例 | JRA-090 #close #comment Fixed this today |
注意 | This example executes the close work item workflow transition for the work item and adds the comment ' この構文にはいくつかの例外があります。
Smart Commit と併用可能なカスタムコマンドを確認するには、 Jira work item and looking at its available workflow transitions:
Smart Commit は、最初のスペースの前のトランジション名の部分のみを考慮します。したがって、 次のように、ワークフローに2つの有効なトランジションがある場合:
アクション
|
高度な例
Multiple commands on a single work item
構文 | <WORK_ITEM_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 |
結果 | Logs 2 days and 5 hours of work against work item JRA-123, adds the comment 'Task completed ahead of schedule', and resolves the work item. |
Multiple commands over multiple lines on a single work item
構文 | <WORK_ITEM_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 |
結果 | 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 work item because there is no work item key for the # この例では、以下のように設定すると、想定通りに動作します。 JRA-123 #comment Imagine that this is a really, and I mean really, long comment JRA-123 #time 2d 5h |
A single command on multiple work items
構文 | <WORK_ITEM_KEY1> <WORK_ITEM_KEY2> <WORK_ITEM_KEY3> #<COMMAND> <optional COMMAND_ARGUMENTS> etc |
---|---|
コミット メッセージ | JRA-123 JRA-234 JRA-345 #resolve |
結果 | Resolves work items JRA-123, JRA-234 and JRA-345. Multiple work item keys must be separated by whitespace or commas. |
Multiple commands on multiple work items
構文 | <WORK_ITEM_KEY1> <WORK_ITEM_KEY2> ... <WORK_ITEM_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 |
結果 | Logs 2 days and 5 hours of work against work items JRA-123, JRA-234 and JRA-345, adds the comment Multiple work item keys must be separated by whitespace or commas. |
Smart Commit の活用
Jira のインスタンスでスマート コミットを使用できるようにするのは簡単です。
ツール | 接続の手順 |
---|---|
Bitbucket Cloud | まず、Jira と Bitbucket アカウントをリンクします。「Jira Cloud と Bitbucket Cloud の接続」を参照してください。 次に、Jira でスマート コミットを有効にします。「スマート コミットの有効化」を参照してください。 |
GitHub | まず、Jira と GitHub アカウントをリンクします。「Jira Cloud と GitHub の接続」を参照してください。 次に、Jira でスマート コミットを有効にします。「スマート コミットの有効化」を参照してください。 |
Bitbucket Data Center | Jira と Bitbucket Data Center 間のアプリケーション リンクを作成します。「Bitbucket Data Center を Jira とリンクする」を参照してください。 次に、Jira でスマート コミットを有効にします。「スマート コミットの有効化」を参照してください。 |
Fisheye | Jira と Fisheye 間のアプリケーション リンクを作成します。「別のアプリケーションへのリンク」を参照してください。 次に、Jira でスマート コミットを有効にします。「スマート コミットの有効化」を参照してください。 |
Crucible | Jira と Crucible 間のアプリケーション リンクを作成します。「別のアプリケーションへのリンク」を参照してください。 次に、Jira でスマート コミットを有効にします。「スマート コミットの有効化」を参照してください。 |
注意
Smart Commits only support the default Jira work item key format. This format is two or more uppercase letters, followed by a hyphen and the work item number, for example JRA-123.
A DVCS such as Git includes a user's email address in the commit data. Users configure this email address in their local system. Smart Commits requires that this email address match exactly one email address in the Jira user base. If the email address matches multiple users in Jira, or the user does not have permissions for the requested action, the Smart Commit action will fail. The commit itself will succeed however, and will show on the work item. Mismatched email addresses is a common reason why Smart Commits fail to work as expected. If a Smart Commit fails, Jira sends an email notification to either the Jira user, or to the DVCS user (if a Jira user can't be identified). In rare cases, Jira doesn't have either of these email addresses, and the Smart Commit fails silently.
この内容はお役に立ちましたか?