> For the complete documentation index, see [llms.txt](https://help.aikido.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.aikido.dev/docs/docs-ja/autofix-to/automation-and-merging/auto-merge-autofix-pull-requests.md).

# AutoFix のプルリクエストを自動マージする

## 自動マージはいつ使うべきですか？

自動マージ機能は、定義された条件がすべて満たされた時点でPull Requestを自動的にマージすることで、開発ワークフローを効率化します。

これにより、Pull Requestを手動で追跡してマージする必要がなくなり、ワークフローの速度を大幅に向上させることができます。開発者は各PRの条件を常に確認したり、定期的にマージを開始したりする必要がなくなります。

Aikidoは、GitHub、GitLab、Azure DevOpsに標準搭載されている自動マージ機能を利用します。Autofixの設定では、Aikidoが作成したPRに対して自動マージを有効にできます。

## GitHub

リポジトリでPull Requestの自動マージを有効にします： [リポジトリのPull Requestで自動マージを管理する - GitHub Docs](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/managing-auto-merge-for-pull-requests-in-your-repository?utm_source=chatgpt.com).[\ <br>](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/managing-auto-merge-for-pull-requests-in-your-repository?utm_source=chatgpt.com)対象ブランチにはブランチ保護ルールを設定することを強く推奨します： [ブランチ保護ルールの管理 - GitHub Docs](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-protected-branches/managing-a-branch-protection-rule)。これにより、自動マージがトリガーされる前に満たす必要のある条件を定義できます。

## GitLab（Cloud & Server）

GitLabリポジトリで自動マージを有効にする方法は、こちらで確認できます： [自動マージ | GitLab Docs](https://docs.gitlab.com/user/project/merge_requests/auto_merge/)

Aikidoが自動マージを有効にしたPRを作成するには、GitLabでブランチポリシーを設定する必要があります： [保護されたブランチ | GitLab Docs](https://docs.gitlab.com/user/project/repository/branches/protected/)

さらに、Aikidoが自動マージを有効にしたPRを作成するには、パイプラインをPRにリンクする必要があります： [CI/CDパイプライン | GitLab Docs](https://docs.gitlab.com/ci/pipelines/)

パイプラインが成功し、マージチェックが完了すると、PRは自動的にマージされます。

## Azure DevOps

PRを自動完了すべきタイミングを定義するため、対象ブランチでブランチポリシーを有効にすることを強く推奨します： [Gitブランチポリシーと設定 - Azure Repos | Microsoft Learn](https://learn.microsoft.com/en-us/azure/devops/repos/git/branch-policies?view=azure-devops\&tabs=browser)

## Bitbucket

Bitbucketには上記のような自動マージ機能はありません。Bitbucketが提供する自動マージ機能を使用する場合でも、ユーザーは依然として手動でマージボタンをクリックする必要があります。 [プルリクエストをマージする | Bitbucket Data Center 10.0 | Atlassian Documentation](https://confluence.atlassian.com/bitbucketserver/merge-a-pull-request-808488562.html)

<br>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://help.aikido.dev/docs/docs-ja/autofix-to/automation-and-merging/auto-merge-autofix-pull-requests.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
