> For the complete documentation index, see [llms.txt](https://docs.flosum.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.flosum.com/devops/devops-ja/she-ding/git-tong-he/git-no.md).

# Git 統合の概要

{% hint style="warning" %}

#### 旧UI向けに作成

この記事は旧UI向けに作成されました。手順は今でも使用できますが、スクリーンショットは古くなっています。場合によっては、手順で参照されている項目が移動または変更されていることがあります。項目が見つからない場合は、 [どこに行ったのか](/devops/devops-ja/shii-uiux-heno/dokonittanoka.md) 記事。
{% endhint %}

## ![](https://225042527-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2FG5ZbxX918xOHwbAwAJ4n%2FSummary2-Small-Icon.svg?alt=media\&token=da26a67f-ff7f-47b3-8669-06be960dc2d7) 概要

Git 連携を使うと、Git リポジトリを DevOps に接続できるため、DevOps ブランチで管理されている Salesforce メタデータが自動的に同期されます。これにより、ブランチとコミットが Git ベースのバージョン管理システムで追跡されます。DevOps のプルリクエストがマージされると、マージされた変更のコミットが作成されます。Git 連携はこのコミットを Git の対象ブランチにプッシュしますが、プルリクエストは Git と同期されません。

{% hint style="info" %}

#### ベストプラクティス

* DevOps ブランチ名には、英字、数字、および次の記号のみを使用してください: `_ / - .`。Git の同期をスムーズに行うため、スペースや特殊文字は避けてください。
* Git 連携を監視する **アクティビティ** 例外を確認し、すばやく解決します。
* フィルターを使用して、特定のブランチ、日付、またはステータスを監査します。
  {% endhint %}

## 同期済みリポジトリの構成

DevOps が Push to Git ジョブによる同期を完了すると、接続された Git リポジトリには DevOps ブランチの状態が反映されます。各同期ジョブでは、追跡可能性のために新しいコミットが作成されます。以下の表では、連携が次の各項目をどのように処理するかを説明します。

<table data-header-hidden><thead><tr><th width="180"></th><th></th></tr></thead><tbody><tr><td>ブランチ</td><td>各 DevOps ブランチは、Git リポジトリ内で同名のブランチとして作成または更新されます。</td></tr><tr><td>コミット</td><td>DevOps はコミットをブランチにプッシュします。コミットには常に <code>DevOps 同期です。ブランチが同期されています。</code> をヘッダーとして持ちます。コミット本文には、この同期中に Git にプッシュされたすべての DevOps コミットの Hash、Message、CreatedAt が含まれます。</td></tr><tr><td>プルリクエスト</td><td>DevOps のプルリクエストがマージされると、マージされた変更のためのコミットが作成されます。Git 連携はこのコミットを Git の対象ブランチにプッシュしますが、プルリクエストは Git と同期されません。プッシュされたコミットのコミット詳細には次の内容が含まれます: <code>メッセージ: ブランチのマージ</code>.</td></tr></tbody></table>

リポジトリは次の形式です **Salesforce DX プロジェクト**で、次の内容を含みます:

* 標準フォルダー
  * force-app/
  * config/
  * scripts/
* 標準ファイル
  * sfdx-project.json
  * package.json
  * README.md

以下のスクリーンショットは、DevOps と同期された GitHub リポジトリ内のブランチの例を示しています。

<figure><img src="https://225042527-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2F2SuhPHJlixMqCpLNqNeS%2FOverviewOfGitIntegrations-Repo-01.png?alt=media&amp;token=59ca4924-fa61-43c3-8bff-5d98c35c5ad1" alt=""><figcaption></figcaption></figure>

### DevOps 同期コミット

DevOps が Git にプッシュする各コミットは、次の形式になります:

#### コミットヘッダー

{% code overflow="wrap" expandable="true" %}

```
DevOps 同期です。ブランチが同期されています。
```

{% endcode %}

#### コミット本文

{% code overflow="wrap" expandable="true" %}

```
同期された DevOps コミット:

Hash: 
Message:
CreatedAt:
```

{% endcode %}

コミット本文には複数の DevOps コミットを含めることができ、各 DevOps コミットについて次の情報が提供されます。

<table data-header-hidden><thead><tr><th width="128.3333740234375"></th><th></th></tr></thead><tbody><tr><td>Hash</td><td>このメッセージで表される DevOps コミットのハッシュコード。</td></tr><tr><td>メッセージ</td><td>DevOps コミットのメッセージ。</td></tr><tr><td>CreatedAt</td><td>DevOps でコミットが作成された時点の ISO 8601 タイムスタンプ。</td></tr></tbody></table>

以下は、GitHub 上の DevOps 同期コミットのサンプルスクリーンショットです。

<details>

<summary>初回ブランチの作成と同期</summary>

Git リポジトリが既存の DevOps テナントに接続されると、ブランチが作成され、そのブランチに関する DevOps 内のすべてのコミットメッセージを含む初回コミットが Git にプッシュされます。以下は GitHub における初回コミットの例です。

<figure><img src="https://225042527-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2F81znbC6bp8uzTEfR7KBh%2FOverviewOfGitIntegrations-Commits-01.png?alt=media&amp;token=9186e33b-f6d5-4872-ae81-12a6cf975c3c" alt=""><figcaption></figcaption></figure>

</details>

<details>

<summary>DevOps コミット</summary>

以下は GitHub における DevOps コミットの例です。

<figure><img src="https://225042527-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2Far5XPO59NVfT0exg1aNh%2FOverviewOfGitIntegrations-Commits-02.png?alt=media&amp;token=a228ead4-8cf0-4b2c-a9b3-6123cc5b7801" alt=""><figcaption></figcaption></figure>

</details>

<details>

<summary>DevOps プルリクエストのマージ</summary>

DevOps のプルリクエストがマージされると、マージされた変更のためのコミットが作成されます。Git 連携はこのコミットを Git の対象ブランチにプッシュしますが、プルリクエストは Git と同期されません。プッシュされたコミットのコミット詳細には次の内容が含まれます: `メッセージ: ブランチのマージ`。以下は GitHub におけるマージコミットの例です。

<figure><img src="https://225042527-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2FwKXbVPUTzMWgoNJLABUv%2FOverviewOfGitIntegrations-Commits-03.png?alt=media&amp;token=8030c406-c129-4f58-bf74-c036e2c7e412" alt=""><figcaption></figcaption></figure>

</details>

#### バンドルされたコミット

状況によっては、Git 連携が複数のコミットを 1 つのコミットにまとめて Git に同期します。Git では、コミットメッセージに各バンドルされた DevOps コミットの詳細が含まれます。たとえば、DevOps でコンポーネントが編集された場合、別のブランチ操作によってプッシュがトリガーされるまで、その結果のコミットは Git にプッシュされません。以下はバンドルされたコミットの例です。

<div align="left"><figure><img src="https://225042527-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2FUzxCEwp4rX3gU9KmjzGt%2FOverviewOfGitIntegrations-Commits-04.png?alt=media&amp;token=9e1a79c7-287a-4e87-9f56-8d3309799864" alt="" width="563"><figcaption></figcaption></figure></div>

{% hint style="warning" %}
コミットのバンドル化により、一時的に Git が DevOps と同期しない状態になることがあります。ただし、DevOps がバンドルされたコミットを Git にプッシュすると、システムは再び同期されます。コミットが Git にプッシュされたかどうか不明な場合は、DevOps ブランチのコミットと Git ブランチのコミットを比較してください。
{% endhint %}

## 対応 Git ホスト

DevOps は、Git リポジトリ用に次のホストに接続できます。

* GitHub
* GitLab
* Azure
* Bitbucket

GitHub への接続に関する詳細な手順は以下の記事に記載されており、手順は同様であるため、他のホストへの接続のガイドとしても利用できます。

* [GitHub リポジトリの接続](/devops/devops-ja/she-ding/git-tong-he/github-ripojitorino.md)


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.flosum.com/devops/devops-ja/she-ding/git-tong-he/git-no.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
