フォークの同期を維持する
Fork syncing helps you to keep your fork in Bitbucket Data Center and Server up-to-date with changes in the upstream repository. Bitbucket can do this automatically for all branches and tags you haven't modified in the fork.
If you have modified branches or tags in the fork, Bitbucket will offer syncing strategies. Bitbucket will never update your branch or tag in your fork if this means that your changes would be lost.
ここでの同期とは、アップストリームの最近の変更をフォークにプルすることであり、プル リクエストは変更をアップストリームのリポジトリにプッシュして戻します。
On this page:
フォークの自動同期を有効化する
リポジトリを初めてフォークする際に、フォークの自動同期を有効にすることができます。
- フォークの同期を有効化する
Syncing is enabled by default. You can disable or enable fork syncing at any time later by going to Repository Settings > Workflow > Fork syncing for the forked repository.
同期される内容
When performing automatic synchronization, Bitbucket updates the fork as follows:
- for branches - Bitbucket makes any fast-forward change, where there is no need to merge work and there is no risk of losing changes.
- for tags - Bitbucket makes updates only if the current state is the same as what upstream pointed to. So, a new tag in upstream will create a new tag in the fork, unless you have a tag of the same name, when the update will fail.
手動での同期
If upstream and your fork have diverged, so that each has changes that are not in the other, Bitbucket will not perform a merge automatically. When you visit the branch, you have the option to manually synchronize the branch.
フォークされたリポジトリの [設定] > [フォークの同期] タブに移動するか、リポジトリの [ソース] または [コミット] タブに移動して、[同期] を使用してブランチをいつでも手動で同期できます。
手動での同期の戦略
When you initiate a manual synchronization, Bitbucket will ask you to choose one of the following synchronization strategies.
マージ戦略
アップストリーム ブランチをフォーク ブランチにマージします。
If Bitbucket detects conflicts when trying to perform the merge it will offer hints on how to resolve those:
マージが完了すると、ブランチには親リポジトリのブランチのすべてのコミットが含まれますが、ブランチは引き続き親よりも先になります (ブランチは変更内容を保持しています)。つまり、このブランチの自動同期は、変更を親リポジトリにプッシュするまで行われません。
Rebase strategy
Rebase the fork branch onto the upstream branch. Creates a new non-merge commit for each commit on the fork.
破棄戦略
フォーク内の変更をアップストリーム ブランチで上書きします。変更は失われます。