merge

NAME

git-merge - Join two or more development histories togethergit-merge - 2つ以上の開発履歴を結合する

SYNOPSIS概要

git merge [-n] [--stat] [--no-commit] [--squash] [--[no-]edit]
	[-s <strategy>] [-X <strategy-option>] [-S[<keyid>]]
	[--[no-]allow-unrelated-histories]
	[--[no-]rerere-autoupdate] [-m <msg>] [-F <file>] [<commit>…​]
git merge --abort
git merge --continue

DESCRIPTION説明

Incorporates changes from the named commits (since the time their histories diverged from the current branch) into the current branch. This command is used by git pull to incorporate changes from another repository and can be used by hand to merge changes from one branch into another.名前付きコミットからの変更を(それらの履歴が現在のブランチから分岐したときからの)現在のブランチに組み込みます。このコマンドは他のリポジトリからの変更を取り込むためgit pullによって使用され、あるブランチから別のブランチへの変更をマージするために手で使用することができます。

Assume the following history exists and the current branch is "master":次の履歴が存在し、現在のブランチが " master"であるとします。

	  A---B---C topic
	 /
    D---E---F---G master

Then "git merge topic" will replay the changes made on the topic branch since it diverged from master (i.e., E) until its current commit (C) on top of master, and record the result in a new commit along with the names of the two parent commits and a log message from the user describing the changes.それから " git merge topic"はtopic分岐から分岐してからmaster(すなわちE)現在のcommit(C)までの間に行われた変更を再生し、そのmaster結果を2つの親コミットの名前とログメッセージと共に新しいコミットに記録します。変更を説明しているユーザーから。

	  A---B---C topic
	 /         \
    D---E---F---G---H master

The second syntax ("git merge --abort") can only be run after the merge has resulted in conflicts. git merge --abort will abort the merge process and try to reconstruct the pre-merge state. However, if there were uncommitted changes when the merge started (and especially if those changes were further modified after the merge was started), git merge --abort will in some cases be unable to reconstruct the original (pre-merge) changes. Therefore:2番目の構文( " git merge --abort")は、マージによって競合が発生した後にのみ実行できます。git merge --abortはマージプロセスを中止し、マージ前の状態を再構築しようとします。しかし、マージの開始時にコミットされていない変更があった場合(そして特にそれらの変更がマージの開始後にさらに修正された場合)、git merge --abortはオリジナルの(マージ前の)変更を再構築できない場合があります。したがって:

Warning: Running git merge with non-trivial uncommitted changes is discouraged: while possible, it may leave you in a state that is hard to back out of in the case of a conflict.警告git mergeを些細でコミットされていない変更と一緒に実行することはお勧めできません:可能であれば、競合の場合には元に戻せない状態になる可能性があります。

The third syntax ("git merge --continue") can only be run after the merge has resulted in conflicts.3番目の構文( " git merge --continue")は、マージによって競合が発生した後にのみ実行できます。

OPTIONSオプション

--commit - コミット
--no-commit

Perform the merge and commit the result. This option can be used to override --no-commit.マージを実行して結果を確定します。このオプションは--no-commitを上書きするために使用できます。

With --no-commit perform the merge but pretend the merge failed and do not autocommit, to give the user a chance to inspect and further tweak the merge result before committing.--no-commitを指定すると、マージを実行しますが、失敗したとみなして自動コミットしないようにします。これにより、コミットする前にユーザーがマージ結果を調べてさらに調整することができます。

--edit - 編集
-e
--no-edit

Invoke an editor before committing successful mechanical merge to further edit the auto-generated merge message, so that the user can explain and justify the merge. The --no-edit option can be used to accept the auto-generated message (this is generally discouraged). The --edit (or -e) option is still useful if you are giving a draft message with the -m option from the command line and want to edit it in the editor.自動生成されたマージメッセージをさらに編集するために正常な機械的マージをコミットする前にエディタを呼び出して、ユーザがマージを説明して正当化できるようにします。この--no-editオプションは自動生成されたメッセージを受け入れるために使うことができます(これは一般的にはお勧めできません)。--edit(または-eあなたが持つドラフトメッセージ与えている場合)オプションはまだ有効です-mコマンドラインからオプションを、エディタで編集したいです。

Older scripts may depend on the historical behaviour of not allowing the user to edit the merge log message. They will see an editor opened when they run git merge. To make it easier to adjust such scripts to the updated behaviour, the environment variable GIT_MERGE_AUTOEDIT can be set to no at the beginning of them.古いスクリプトは、ユーザーがマージログメッセージを編集できないという過去の動作に依存する可能性があります。実行するとエディタが開きますgit merge。そのようなスクリプトを更新された動作に合わせやすくするために、環境変数GIT_MERGE_AUTOEDITをスクリプトnoの先頭に設定することができます。

--ff

When the merge resolves as a fast-forward, only update the branch pointer, without creating a merge commit. This is the default behavior.マージが早送りとして解決した場合は、マージコミットを作成せずに分岐ポインタのみを更新します。これがデフォルトの動作です。

--no-ff

Create a merge commit even when the merge resolves as a fast-forward. This is the default behaviour when merging an annotated (and possibly signed) tag that is not stored in its natural place in refs/tags/ hierarchy.マージが早送りとして解決された場合でもマージコミットを作成します。これは、refs / tags / hierarchyの本来の場所に格納されていない注釈付き(そしておそらく署名付き)タグをマージするときのデフォルトの動作です。

--ff-only

Refuse to merge and exit with a non-zero status unless the current HEAD is already up to date or the merge can be resolved as a fast-forward.現在HEADが最新であるか、マージが早送りとして解決できる場合を除き、マージを拒否してゼロ以外のステータスで終了します。

-S[<keyid>] -S [<keyid>]
--gpg-sign[=<keyid>] --gpg-sign [= <keyid>]

GPG-sign the resulting merge commit. The keyid argument is optional and defaults to the committer identity; if specified, it must be stuck to the option without a space.結果のマージコミットにGPG署名します。keyid引数はコミッターのアイデンティティオプションで、デフォルトです。指定した場合は、スペースなしでオプションに固定する必要があります。

--log[=<n>] --log [= <n>]
--no-log

In addition to branch names, populate the log message with one-line descriptions from at most <n> actual commits that are being merged. See also git-fmt-merge-msg[1].ブランチ名に加えて、マージされている最大<n>個の実際のコミットからの1行の説明をログメッセージに入れます。git-fmt-merge-msg [1]もご覧ください。

With --no-log do not list one-line descriptions from the actual commits being merged.--no-logを使用すると、マージされている実際のコミットから1行の説明を表示しません。

--signoff - サインオフ
--no-signoff

Add Signed-off-by line by the committer at the end of the commit log message. The meaning of a signoff depends on the project, but it typically certifies that committer has the rights to submit this work under the same license and agrees to a Developer Certificate of Origin (see http://developercertificate.org/ for more information).コミットログメッセージの最後に、コミッターによるサインオフラインを追加します。承認の意味はプロジェクトによって異なりますが、通常、コミッターは同じライセンスの下でこの作品を送信する権利を持っていることを証明し、開発者証明書に同意します(詳細についてはhttp://developercertificate.org/を参照)。

With --no-signoff do not add a Signed-off-by line.--no-signoffを使用すると、Signed-off-by行を追加しません。

--stat - スタット
-n
--no-stat

Show a diffstat at the end of the merge. The diffstat is also controlled by the configuration option merge.stat.マージの終わりにdiffstatを表示します。diffstatは設定オプションmerge.statによっても制御されます。

With -n or --no-stat do not show a diffstat at the end of the merge.-nまたは--no-statを指定すると、マージの最後にdiffstatを表示しません。

--squash - 押しつぶす
--no-squash - スカッシュなし

Produce the working tree and index state as if a real merge happened (except for the merge information), but do not actually make a commit, move the HEAD, or record $GIT_DIR/MERGE_HEAD (to cause the next git commit command to create a merge commit). This allows you to create a single commit on top of the current branch whose effect is the same as merging another branch (or more in case of an octopus).実際のマージが行われたかのように(マージ情報を除いて)作業ツリーとインデックスの状態を生成しますが、実際にはコミットを行わずHEAD、またはレコードを移動します$GIT_DIR/MERGE_HEAD(次のgit commitコマンドでマージコミットを作成します)。これにより、現在のブランチの上に単一のコミットを作成でき、その効果は別のブランチをマージするのと同じです(またはタコの場合はそれ以上)。

With --no-squash perform the merge and commit the result. This option can be used to override --squash.--no-squashを使用すると、マージを実行して結果をコミットします。このオプションは--squashを上書きするために使用できます。

-s <strategy> -s <戦略>
--strategy=<strategy> --strategy = <strategy>

Use the given merge strategy; can be supplied more than once to specify them in the order they should be tried. If there is no -s option, a built-in list of strategies is used instead (git merge-recursive when merging a single head, git merge-octopus otherwise).与えられたマージ戦略を使います。試してみるべき順序でそれらを指定するために複数回指定することができます。-s選択肢がない場合は、代わりに戦略の組み込みリストが使用されます(シングルヘッドをマージする場合はgit merge-recursive、それ以外の場合はgit merge-octopus)。

-X <option> -X <オプション>
--strategy-option=<option> --strategy-option = <オプション>

Pass merge strategy specific option through to the merge strategy.マージストラテジ固有のオプションをマージストラテジに渡します。

--verify-signatures - 署名を検証する
--no-verify-signatures

Verify that the tip commit of the side branch being merged is signed with a valid key, i.e. a key that has a valid uid: in the default trust model, this means the signing key has been signed by a trusted key. If the tip commit of the side branch is not signed with a valid key, the merge is aborted.マージされるサイドブランチのチップコミットが有効なキー、つまり有効なuidを持つキーで署名されていることを確認します。デフォルトの信頼モデルでは、署名キーは信頼できるキーによって署名されています。サイドブランチのチップコミットが有効なキーで署名されていない場合、マージは中止されます。

--summary - 概要
--no-summary

Synonyms to --stat and --no-stat; these are deprecated and will be removed in the future.--statおよび--no-statの同義語。これらは非推奨であり、将来削除される予定です。

-q
--quiet - 静か

Operate quietly. Implies --no-progress.静かに操作してください。--no-progressを意味します。

-v
--verbose - 冗談

Be verbose.冗長になります。

--progress - 進捗
--no-progress

Turn progress on/off explicitly. If neither is specified, progress is shown if standard error is connected to a terminal. Note that not all merge strategies may support progress reporting.進行状況を明示的にオン/オフにします。どちらも指定されていない場合、標準エラーが端末に接続されていれば進行状況が表示されます。すべてのマージ戦略が進捗レポートをサポートしているとは限らないことに注意してください。

--allow-unrelated-histories - 無関係な歴史

By default, git merge command refuses to merge histories that do not share a common ancestor. This option can be used to override this safety when merging histories of two projects that started their lives independently. As that is a very rare occasion, no configuration variable to enable this by default exists and will not be added.デフォルトでは、git mergecommandは共通の先祖を共有しない履歴をマージすることを拒否します。このオプションは、独立して生活を始めた2つのプロジェクトの履歴をマージするときにこの安全性を無効にするために使用できます。これはごくまれなことですが、デフォルトでこれを有効にする設定変数は存在せず、追加されません。

-m <msg>

Set the commit message to be used for the merge commit (in case one is created).マージコミットに使用するコミットメッセージを設定します(作成された場合)。

If --log is specified, a shortlog of the commits being merged will be appended to the specified message.場合は--log、指定され、マージされるコミットのshortlogは、指定されたメッセージに追加されます。

The git fmt-merge-msg command can be used to give a good default for automated git merge invocations. The automated message can include the branch description.GitのFMT-マージ-MSGコマンドは、自動化のための適切なデフォルト与えるために使用することができますgitのマージ呼び出しを。自動メッセージにはブランチの説明を含めることができます。

-F <file> -F <ファイル>
--file=<file> --file = <ファイル>

Read the commit message to be used for the merge commit (in case one is created).マージコミットに使用するコミットメッセージを読み取ります(作成された場合)。

If --log is specified, a shortlog of the commits being merged will be appended to the specified message.場合は--log、指定され、マージされるコミットのshortlogは、指定されたメッセージに追加されます。

--[no-]rerere-autoupdate - [no-] rerere-autoupdate

Allow the rerere mechanism to update the index with the result of auto-conflict resolution if possible.可能であれば、rerereメカニズムが自動競合解決の結果でインデックスを更新することを許可します。

--abort - アボート

Abort the current conflict resolution process, and try to reconstruct the pre-merge state.現在の競合解決プロセスを中止し、マージ前の状態を再構築します。

If there were uncommitted worktree changes present when the merge started, git merge --abort will in some cases be unable to reconstruct these changes. It is therefore recommended to always commit or stash your changes before running git merge.マージの開始時にコミットされていない作業ツリーの変更があった場合、git merge --abortはこれらの変更を再構築できないことがあります。そのため、git mergeを実行する前に、常に変更をコミットするか隠しておくことをお勧めします。

git merge --abort is equivalent to git reset --merge when MERGE_HEAD is present.git merge --abortgit reset --merge when MERGE_HEADが存在する場合と同じです。

--continue - 持続する

After a git merge stops due to conflicts you can conclude the merge by running git merge --continue (see "HOW TO RESOLVE CONFLICTS" section below).gitマージが衝突のために停止した後は、git merge --continueを実行することでマージを終了することができます(下記の「競合の解決方法」を参照)。

<commit>…​ <コミット>…

Commits, usually other branch heads, to merge into our branch. Specifying more than one commit will create a merge with more than two parents (affectionately called an Octopus merge).通常は他のブランチヘッドも含めて、ブランチにマージすることをコミットします。複数のコミットを指定すると、2つ以上の親とのマージが作成されます(愛情を込めてOctopusマージと呼ばれます)。

If no commit is given from the command line, merge the remote-tracking branches that the current branch is configured to use as its upstream. See also the configuration section of this manual page.コマンドラインからコミットが行われていない場合は、現在のブランチがアップストリームとして使用するように設定されているリモートトラッキングブランチをマージします。このマニュアルページの設定セクションも参照してください。

When FETCH_HEAD (and no other commit) is specified, the branches recorded in the .git/FETCH_HEAD file by the previous invocation of git fetch for merging are merged to the current branch.FETCH_HEAD他のコミットが指定されていない場合は.git/FETCH_HEAD、前回のgit fetchマージの呼び出しによってファイルに記録されたブランチが現在のブランチにマージされます。

PRE-MERGE CHECKSマージ前チェック

Before applying outside changes, you should get your own work in good shape and committed locally, so it will not be clobbered if there are conflicts. See also git-stash[1]. git pull and git merge will stop without doing anything when local uncommitted changes overlap with files that git pull/git merge may need to update.外部の変更を適用する前に、自分自身の作業を適切に整形してローカルにコミットする必要があります。そのため、競合があっても問題にはなりません。git-stash [1]もご覧ください。ローカルのコミットされていない変更がgit pull / git mergeが更新を必要とする可能性あるファイルと重複する場合、git pullおよびgit mergeは何もせずに停止します。

To avoid recording unrelated changes in the merge commit, git pull and git merge will also abort if there are any changes registered in the index relative to the HEAD commit. (Special narrow exceptions to this rule may exist depending on which merge strategy is in use, but generally, the index must match HEAD.)マージコミットに無関係な変更が記録されないようにするために、コミットに関連してインデックスに変更が登録されていると、git pullおよびgit mergeも中止されHEADます。(使用されているマージ戦略によっては、この規則に対する特別な狭い例外が存在する可能性がありますが、通常、インデックスはHEADと一致する必要があります。)

If all named commits are already ancestors of HEAD, git merge will exit early with the message "Already up to date."すべての名前付きコミットが既に先祖のものであるHEAD場合、git mergeは "Already up to date"というメッセージで早く終了します。

FAST-FORWARD MERGE早送りマージ

Often the current branch head is an ancestor of the named commit. This is the most common case especially when invoked from git pull: you are tracking an upstream repository, you have committed no local changes, and now you want to update to a newer upstream revision. In this case, a new commit is not needed to store the combined history; instead, the HEAD (along with the index) is updated to point at the named commit, without creating an extra merge commit.多くの場合、現在のブランチヘッドは、名前付きコミットの先祖です。これは、特にgit pullから呼び出されたときに最も一般的なケースです。上流のリポジトリを追跡していて、ローカルの変更をコミットしていないので、今度は新しい上流のリビジョンに更新したいと思います。この場合、結合された履歴を保存するために新しいコミットは必要ありません。代わりに、HEAD(インデックスと共に)追加のマージコミットを作成せずに、名前付きコミットを指すように更新されます。

This behavior can be suppressed with the --no-ff option.この動作は--no-ffオプションで抑制できます。

TRUE MERGE

Except in a fast-forward merge (see above), the branches to be merged must be tied together by a merge commit that has both of them as its parents.早送りマージ(上記参照)を除いて、マージされるブランチは、両方を親とするマージコミットによって結び付けられなければなりません。

A merged version reconciling the changes from all branches to be merged is committed, and your HEAD, index, and working tree are updated to it. It is possible to have modifications in the working tree as long as they do not overlap; the update will preserve them.マージされるすべてのブランチからの変更を調整したマージバージョンがコミットされ、あなたのHEADインデックスと作業ツリーがそれに更新されます。重複しない限り、作業ツリーに変更を加えることができます。更新はそれらを保存します。

When it is not obvious how to reconcile the changes, the following happens:変更を調整する方法が明確でない場合は、次のようになります。

  1. The HEAD pointer stays the same.HEADポインタは同じまま。

  2. The MERGE_HEAD ref is set to point to the other branch head.MERGE_HEADrefは、他のブランチヘッドを指すように設定されています。

  3. Paths that merged cleanly are updated both in the index file and in your working tree.きれいにマージされたパスは、インデックスファイルと作業ツリーの両方で更新されます。

  4. For conflicting paths, the index file records up to three versions: stage 1 stores the version from the common ancestor, stage 2 from HEAD, and stage 3 from MERGE_HEAD (you can inspect the stages with git ls-files -u). The working tree files contain the result of the "merge" program; i.e. 3-way merge results with familiar conflict markers <<< === >>>.競合するパスの場合、インデックスファイルには最大3つのバージョンが記録されます。ステージ1は共通の先祖からのバージョン、ステージ2はからHEAD、ステージ3はからのバージョンを格納しMERGE_HEADます(ステージを調べることができますgit ls-files -u)。作業ツリーファイルは "merge"プログラムの結果を含みます。すなわち、3-wayマージの結果は、よく知られている競合マーカーと一致し<<< === >>>ます。

  5. No other changes are made. In particular, the local modifications you had before you started merge will stay the same and the index entries for them stay as they were, i.e. matching HEAD.他の変更はありません。特に、マージを開始する前に行ったローカルの変更内容は同じままで、それらのインデックスエントリはそのまま、つまり一致したままになりHEADます。

If you tried a merge which resulted in complex conflicts and want to start over, you can recover with git merge --abort.複雑な衝突を引き起こして最初からやり直したいマージを試みた場合は、で回復できますgit merge --abort

MERGING TAGマージタグ

When merging an annotated (and possibly signed) tag, Git always creates a merge commit even if a fast-forward merge is possible, and the commit message template is prepared with the tag message. Additionally, if the tag is signed, the signature check is reported as a comment in the message template. See also git-tag[1].注釈付きの(そしておそらく署名済みの)タグをマージするとき、早送りマージが可能であってもGitは常にマージコミットを作成し、コミットメッセージテンプレートはタグメッセージで準備されます。さらに、タグが署名されている場合、署名チェックはメッセージテンプレートのコメントとして報告されます。git-tag [1]もご覧ください。

When you want to just integrate with the work leading to the commit that happens to be tagged, e.g. synchronizing with an upstream release point, you may not want to make an unnecessary merge commit.タグ付けされたコミットを引き起こす作業、例えば上流のリリースポイントと同期する作業と統合するだけの場合は、不要なマージコミットをしたくないかもしれません。

In such a case, you can "unwrap" the tag yourself before feeding it to git merge, or pass --ff-only when you do not have any work on your own. e.g.そのような場合は、タグをフィードする前に自分で「ラップを解除」するか、自分で作業をしていないときにgit merge渡す--ff-onlyことができます。例えば

git fetch origin
git merge v1.2.3^0
git merge --ff-only v1.2.3

HOW CONFLICTS ARE PRESENTED矛盾はどのように提示されますか

During a merge, the working tree files are updated to reflect the result of the merge. Among the changes made to the common ancestor’s version, non-overlapping ones (that is, you changed an area of the file while the other side left that area intact, or vice versa) are incorporated in the final result verbatim. When both sides made changes to the same area, however, Git cannot randomly pick one side over the other, and asks you to resolve it by leaving what both sides did to that area.マージ中に、作業ツリーファイルはマージの結果を反映するように更新されます。共通の祖先のバージョンに加えられた変更のうち、重ならないもの(つまり、ファイルのある領域を変更したまま反対側がその領域を変更していない、またはその逆)は、最終結果にそのまま反映されます。しかし、両側が同じ領域に変更を加えた場合、Gitは一方を他方に無作為に選ぶことはできず、両側がその領域に行ったことをそのままにして解決するように求めます。

By default, Git uses the same style as the one used by the "merge" program from the RCS suite to present such a conflicted hunk, like this:デフォルトでは、GitはRCSスイートの "merge"プログラムで使用されているものと同じスタイルを使用して、このような衝突した塊を表示します。

Here are lines that are either unchanged from the common
ancestor, or cleanly resolved because only one side changed.
<<<<<<< yours:sample.txt
Conflict resolution is hard;
let's go shopping.
=======
Git makes conflict resolution easy.
>>>>>>> theirs:sample.txt
And here is another line that is cleanly resolved or unmodified.

The area where a pair of conflicting changes happened is marked with markers <<<<<<<, =======, and >>>>>>>. The part before the ======= is typically your side, and the part afterwards is typically their side.競合する変更のペアが起こった領域は、マーカーでマークされ<<<<<<<=======>>>>>>>。の前の部分=======は通常あなたの側であり、その後の部分は通常その側です。

The default format does not show what the original said in the conflicting area. You cannot tell how many lines are deleted and replaced with Barbie’s remark on your side. The only thing you can tell is that your side wants to say it is hard and you’d prefer to go shopping, while the other side wants to claim it is easy.デフォルトのフォーマットでは、競合する分野でオリジナルが言ったことは示されていません。あなたは何行削除され、あなたの側でバービーの発言に置き換えられるのかわかりません。あなたが言うことができる唯一のことはあなたの側がそれが難しいと言いたいとあなたが買い物に行きたいと思う一方で、他方の側がそれが簡単であると主張したいということです。

An alternative style can be used by setting the "merge.conflictStyle" configuration variable to "diff3". In "diff3" style, the above conflict may look like this:"merge.conflictStyle"設定変数を "diff3"に設定することで別のスタイルを使うことができます。"diff3"スタイルでは、上記の衝突は次のようになります。

Here are lines that are either unchanged from the common
ancestor, or cleanly resolved because only one side changed.
<<<<<<< yours:sample.txt
Conflict resolution is hard;
let's go shopping.
|||||||
Conflict resolution is hard.
=======
Git makes conflict resolution easy.
>>>>>>> theirs:sample.txt
And here is another line that is cleanly resolved or unmodified.

In addition to the <<<<<<<, =======, and >>>>>>> markers, it uses another ||||||| marker that is followed by the original text. You can tell that the original just stated a fact, and your side simply gave in to that statement and gave up, while the other side tried to have a more positive attitude. You can sometimes come up with a better resolution by viewing the original.加えて<<<<<<<=======及び>>>>>>>マーカー、それは別の使用|||||||元のテキストが続いているマーカー。あなたは、オリジナルが事実を述べたばかりで、あなたの側が単にその声明をあきらめてあきらめた一方で、他方の側がもっと前向きな姿勢をとろうとしたと言うことができます。あなたは時々オリジナルを見ることによってより良い解像度を思いつくことができます。

HOW TO RESOLVE CONFLICTS矛盾を解決する方法

After seeing a conflict, you can do two things:衝突が発生したら、次の2つのことができます。

  • Decide not to merge. The only clean-ups you need are to reset the index file to the HEAD commit to reverse 2. and to clean up working tree changes made by 2. and 3.; git merge --abort can be used for this.マージしないことを決定します。あなたが必要とする唯一のクリーンアップは、HEAD2.を元に戻し、2.と3によって行われた作業ツリーの変更をクリーンアップするためにコミットにインデックスファイルをリセットすることです。git merge --abortこれに使用することができます。

  • Resolve the conflicts. Git will mark the conflicts in the working tree. Edit the files into shape and git add them to the index. Use git commit or git merge --continue to seal the deal. The latter command checks whether there is a (interrupted) merge in progress before calling git commit.衝突を解決してください。Gitはワーキングツリーの衝突をマークします。ファイルを形に編集し、gitでそれらをインデックスに追加します。使用gitのコミットまたはgitの--continue合併契約を密封します。後者のコマンドは、git commitを呼び出す前に、進行中の(中断された)マージがあるかどうかを確認します。

You can work through the conflict with a number of tools:あなたは多くのツールとの衝突を乗り越えることができます。

  • Use a mergetool. git mergetool to launch a graphical mergetool which will work you through the merge.マージツールを使用してください。git mergetoolグラフィカルなmergetoolを起動してマージを進めます。

  • Look at the diffs. git diff will show a three-way diff, highlighting changes from both the HEAD and MERGE_HEAD versions.差分を見てください。git diffとの両方からの変更を強調して、3者間差分を表示HEADMERGE_HEADます。

  • Look at the diffs from each branch. git log --merge -p <path> will show diffs first for the HEAD version and then the MERGE_HEAD version.各ブランチからの差分を見てください。git log --merge -p <path>まずHEADバージョンの差分を、次にバージョンの差分を表示しMERGE_HEADます。

  • Look at the originals. git show :1:filename shows the common ancestor, git show :2:filename shows the HEAD version, and git show :3:filename shows the MERGE_HEAD version.オリジナルを見てください。git show :1:filename共通の祖先を示し、git show :2:filename示しHEADたバージョンを、とgit show :3:filename示しMERGE_HEADバージョンを。

EXAMPLES

  • Merge branches fixes and enhancements on top of the current branch, making an octopus merge:fixesenhancements現在の枝の上にマージし、タコをマージします。

    $ git merge fixes enhancements
  • Merge branch obsolete into the current branch, using ours merge strategy:マージ戦略obsoleteを使用oursして、ブランチを現在のブランチにマージします。

    $ git merge -s ours obsolete
  • Merge branch maint into the current branch, but do not make a new commit automatically:ブランチmaintを現在のブランチにマージしますが、自動的に新しいコミットをしないでください。

    $ git merge --no-commit maint

    This can be used when you want to include further changes to the merge, or want to write your own merge commit message.これは、マージにさらに変更を加えたい場合や、独自のマージコミットメッセージを書きたい場合に使用できます。

    You should refrain from abusing this option to sneak substantial changes into a merge commit. Small fixups like bumping release/version name would be acceptable.このオプションを悪用して大幅な変更をマージコミットに組み込むことは控えてください。リリース/バージョン名の衝突などの小規模な修正でも問題ありません。

MERGE STRATEGIESマージ戦略

The merge mechanism (git merge and git pull commands) allows the backend merge strategies to be chosen with -s option. Some strategies can also take their own options, which can be passed by giving -X<option> arguments to git merge and/or git pull.マージメカニズム(git mergeおよびgit pullコマンド)を使用すると、オプションでバックエンドのマージ戦略を選択-sできます。いくつかの戦略は独自のオプションを取ることもできます。そしてそれは/ やに-X<option>引数を与えることで渡すことができます。git mergegit pull

resolve 解決する

This can only resolve two heads (i.e. the current branch and another branch you pulled from) using a 3-way merge algorithm. It tries to carefully detect criss-cross merge ambiguities and is considered generally safe and fast.これは3方向マージアルゴリズムを使用して2つのヘッド(つまり現在のブランチとあなたが引っ張った別のブランチ)を解決することしかできません。危機的なクロスマージのあいまいさを慎重に検出しようとしますが、一般的に安全かつ高速と見なされます。

recursive 再帰的

This can only resolve two heads using a 3-way merge algorithm. When there is more than one common ancestor that can be used for 3-way merge, it creates a merged tree of the common ancestors and uses that as the reference tree for the 3-way merge. This has been reported to result in fewer merge conflicts without causing mismerges by tests done on actual merge commits taken from Linux 2.6 kernel development history. Additionally this can detect and handle merges involving renames, but currently cannot make use of detected copies. This is the default merge strategy when pulling or merging one branch.これは3方向マージアルゴリズムを使用して2つのヘッドを解決することしかできません。3者間マージに使用できる共通の祖先が複数ある場合は、共通の祖先のマージされたツリーを作成し、それを3者間マージの参照ツリーとして使用します。これは、Linux 2.6カーネル開発の歴史から取られた実際のマージコミットに対して行われたテストによるミスマージを引き起こすことなく、マージコンフリクトが少なくなると報告されています。さらに、これは名前の変更を含むマージを検出して処理できますが、現在のところ検出されたコピーを利用することはできません。これは、1つのブランチをプルまたはマージするときのデフォルトのマージ戦略です。

The recursive strategy can take the following options:再帰的な戦略は、次のオプションを取ることができます。

ours 私たちのもの

This option forces conflicting hunks to be auto-resolved cleanly by favoring our version. Changes from the other tree that do not conflict with our side are reflected to the merge result. For a binary file, the entire contents are taken from our side.このオプションは私たちのバージョンを支持することによって衝突しているハンクをきれいに自動解決することを強制します。私たちの側と矛盾しない他のツリーからの変更はマージ結果に反映されます。バイナリファイルの場合、内容全体が私たちの側から取られます。

This should not be confused with the ours merge strategy, which does not even look at what the other tree contains at all. It discards everything the other tree did, declaring our history contains all that happened in it.これは、他のツリーに含まれているものをまったく見ないという、当社のマージ戦略と混同しないでください。それは他の木がしたすべてを捨てて、私たちの歴史がそれで起こったことすべてを含むと宣言します

theirs 彼らの

This is the opposite of ours; note that, unlike ours, there is no theirs merge strategy to confuse this merge option with.これは私たちの反対です。注意してください、私たちのものとは異なり、このマージオプションを混同する彼らのマージ戦略はありません。

patience 忍耐

With this option, merge-recursive spends a little extra time to avoid mismerges that sometimes occur due to unimportant matching lines (e.g., braces from distinct functions). Use this when the branches to be merged have diverged wildly. See also git-diff[1] --patience.このオプションを指定すると、merge-recursiveは、重要でない一致行(たとえば、異なる関数の中括弧)が原因で発生することがあるミスマージを回避するために、少し余分な時間を費やします。マージされるブランチが激しく分岐したときにこれを使用してください。git-diff [1] もご覧ください--patience

diff-algorithm=[patience|minimal|histogram|myers] diff-algorithm = [忍耐|最小|ヒストグラム|マイヤーズ]

Tells merge-recursive to use a different diff algorithm, which can help avoid mismerges that occur due to unimportant matching lines (such as braces from distinct functions). See also git-diff[1] --diff-algorithm.伝えマージ再帰的(例えば、別個の機能からブレースなどの)重要でないマッチング線による発生mismergesを回避することができ、異なる差分アルゴリズムを、使用します。git-diff [1] もご覧ください--diff-algorithm

ignore-space-change 無視スペース変更
ignore-all-space 全スペースを無視
ignore-space-at-eol
ignore-cr-at-eol

Treats lines with the indicated type of whitespace change as unchanged for the sake of a three-way merge. Whitespace changes mixed with other changes to a line are not ignored. See also git-diff[1] -b, -w, --ignore-space-at-eol, and --ignore-cr-at-eol.3方向マージのために、指定されたタイプの空白変更を持つ行を変更されていないものとして扱います。行に対する他の変更と混在する空白の変更は無視されません。参照してください[1]のgit-diffのに -b-w--ignore-space-at-eol、と--ignore-cr-at-eol

  • If their version only introduces whitespace changes to a line, our version is used;それらのバージョンが行に空白の変更を導入するだけなら、私たちのバージョンが使われます。

  • If our version introduces whitespace changes but their version includes a substantial change, their version is used;場合は、私たちのバージョンが空白の変更を導入したが、そのバージョンは実質的な変化が含まれ、そのバージョンが使用されています。

  • Otherwise, the merge proceeds in the usual way.それ以外の場合、マージは通常の方法で進行します。

renormalize くりこむ

This runs a virtual check-out and check-in of all three stages of a file when resolving a three-way merge. This option is meant to be used when merging branches with different clean filters or end-of-line normalization rules. See "Merging branches with differing checkin/checkout attributes" in gitattributes[5] for details.これは、3者間マージを解決するときに、ファイルの3つのステージすべての仮想チェックアウトおよびチェックインを実行します。このオプションは、異なるクリーンフィルタまたは行末正規化ルールを使用してブランチをマージするときに使用することを目的としています。詳細はgitattributes [5]の "異なるチェックイン/チェックアウト属性を持つブランチのマージ"を参照してください。

no-renormalize 繰り込まない

Disables the renormalize option. This overrides the merge.renormalize configuration variable.renormalizeオプションを無効にします。これはmerge.renormalize設定変数を上書きします。

no-renames 名前変更なし

Turn off rename detection. This overrides the merge.renames configuration variable. See also git-diff[1] --no-renames.名前変更検出をオフにします。これはmerge.renames設定変数を上書きします。git-diff [1] もご覧ください--no-renames

find-renames[=<n>] 検索リネーム[= <n>]

Turn on rename detection, optionally setting the similarity threshold. This is the default. This overrides the merge.renames configuration variable. See also git-diff[1] --find-renames.名前の変更の検出をオンにし、オプションで類似度のしきい値を設定します。これがデフォルトです。これはmerge.renames設定変数を上書きします。git-diff [1] もご覧ください--find-renames

rename-threshold=<n> 名前変更しきい値= <n>

Deprecated synonym for find-renames=<n>.の廃止予定の同義語find-renames=<n>

subtree[=<path>] サブツリー[= <パス>]

This option is a more advanced form of subtree strategy, where the strategy makes a guess on how two trees must be shifted to match with each other when merging. Instead, the specified path is prefixed (or stripped from the beginning) to make the shape of two trees to match.このオプションは、より高度な形式のサブツリー戦略で、2つのツリーをマージ時に一致させるために2つのツリーをどのようにシフトする必要があるかを推測します。代わりに、指定されたパスに接頭語(または先頭から削除)を付けて、2本の木の形状を一致させます。

octopus たこ

This resolves cases with more than two heads, but refuses to do a complex merge that needs manual resolution. It is primarily meant to be used for bundling topic branch heads together. This is the default merge strategy when pulling or merging more than one branch.これは3つ以上の頭を持つケースを解決しますが、手動の解決を必要とする複雑なマージをすることを拒否します。これは主にトピックブランチのヘッドをまとめるために使われることを意図しています。これは、複数のブランチをプルまたはマージするときのデフォルトのマージ戦略です。

ours 私たちのもの

This resolves any number of heads, but the resulting tree of the merge is always that of the current branch head, effectively ignoring all changes from all other branches. It is meant to be used to supersede old development history of side branches. Note that this is different from the -Xours option to the recursive merge strategy.これは任意の数のヘッドを解決しますが、結果として得られるマージのツリーは常に現在のブランチヘッドのツリーになり、他のすべてのブランチからのすべての変更を事実上無視します。それはサイドブランチの古い開発履歴に取って代わるために使われることを意図しています。これは再帰的マージ戦略の-Xoursオプションとは異なることに注意してください。

subtree サブツリー

This is a modified recursive strategy. When merging trees A and B, if B corresponds to a subtree of A, B is first adjusted to match the tree structure of A, instead of reading the trees at the same level. This adjustment is also done to the common ancestor tree.これは修正された再帰的戦略です。ツリーAとBをマージするとき、BがAのサブツリーに対応する場合、Bは、同じレベルでツリーを読み取るのではなく、まずAのツリー構造と一致するように調整されます。この調整は共通の先祖ツリーに対しても行われます。

With the strategies that use 3-way merge (including the default, recursive), if a change is made on both branches, but later reverted on one of the branches, that change will be present in the merged result; some people find this behavior confusing. It occurs because only the heads and the merge base are considered when performing a merge, not the individual commits. The merge algorithm therefore considers the reverted change as no change at all, and substitutes the changed version instead.3方向マージ(デフォルト、再帰を含む)を使用する戦略では、両方のブランチで変更が行われたが、後で一方のブランチで元に戻された場合、その変更はマージ結果に反映されます。何人かの人々はこの行動が紛らわしいと思います。これは、個々のコミットではなく、マージを実行するときにヘッドとマージベースのみが考慮されるために発生します。したがって、マージアルゴリズムは、元に戻された変更をまったく変更なしと見なし、代わりに変更されたバージョンを代わりに使用します。

CONFIGURATION設定

merge.conflictStyle

Specify the style in which conflicted hunks are written out to working tree files upon merge. The default is "merge", which shows a <<<<<<< conflict marker, changes made by one side, a ======= marker, changes made by the other side, and then a >>>>>>> marker. An alternate style, "diff3", adds a ||||||| marker and the original text before the ======= marker.マージ時に競合するハンクが作業ツリーファイルに書き出されるスタイルを指定します。デフォルトは "merge"で、<<<<<<<競合マーカー、一方の側による変更、=======マーカー、もう一方の側による変更、そして>>>>>>>マーカーが表示されます。代替スタイル "diff3"は、|||||||マーカーと=======マーカーの前に元のテキストを追加します。

merge.defaultToUpstream

If merge is called without any commit argument, merge the upstream branches configured for the current branch by using their last observed values stored in their remote-tracking branches. The values of the branch.<current branch>.merge that name the branches at the remote named by branch.<current branch>.remote are consulted, and then they are mapped via remote.<remote>.fetch to their corresponding remote-tracking branches, and the tips of these tracking branches are merged.commit引数なしでmergeが呼び出された場合は、現在のブランチ用に設定されているアップストリームブランチを、リモートトラッキングブランチに格納されている最後の観測値を使用してマージします。でbranch.<current branch>.merge指名されたリモートのブランチのその名前の値branch.<current branch>.remoteが調べられ、それからそれらはremote.<remote>.fetch対応するリモートトラッキングブランチにマッピングされ、これらのトラッキングブランチのチップはマージされます。

merge.ff

By default, Git does not create an extra merge commit when merging a commit that is a descendant of the current commit. Instead, the tip of the current branch is fast-forwarded. When set to false, this variable tells Git to create an extra merge commit in such a case (equivalent to giving the --no-ff option from the command line). When set to only, only such fast-forward merges are allowed (equivalent to giving the --ff-only option from the command line).デフォルトでは、Gitは現在のコミットの子孫であるコミットをマージするときに追加のマージコミットを作成しません。代わりに、現在のブランチの先端は早送りされます。に設定するとfalse、この変数はそのような場合に追加のコミットコミットを作成するようにGitに指示します(--no-ffコマンドラインからオプションを与えるのと同じです)。に設定するとonly、そのような早送りマージのみが許可されます(--ff-onlyコマンドラインからオプションを指定するのと同じ)。

merge.verifySignatures

If true, this is equivalent to the --verify-signatures command line option. See git-merge[1] for details.trueの場合、これは--verify-signaturesコマンドラインオプションと同じです。詳細はgit-merge [1]を見てください。

merge.branchdesc

In addition to branch names, populate the log message with the branch description text associated with them. Defaults to false.ブランチ名に加えて、それらに関連付けられたブランチの説明テキストをログメッセージに入力します。デフォルトはfalseです。

merge.log

In addition to branch names, populate the log message with at most the specified number of one-line descriptions from the actual commits that are being merged. Defaults to false, and true is a synonym for 20.ブランチ名に加えて、マージされている実際のコミットから最大で指定された数の1行の記述をログメッセージに入れます。デフォルトはfalseで、trueは20の同義語です。

merge.renameLimit

The number of files to consider when performing rename detection during a merge; if not specified, defaults to the value of diff.renameLimit. This setting has no effect if rename detection is turned off.マージ中に名前変更検出を実行するときに考慮するファイルの数。指定しない場合、デフォルトはdiff.renameLimitの値になります。名前変更検出がオフになっている場合、この設定は効果がありません。

merge.renames

Whether and how Git detects renames. If set to "false", rename detection is disabled. If set to "true", basic rename detection is enabled. Defaults to the value of diff.renames.Gitが名前の変更を検出するかどうかとその方法。"false"に設定すると、名前変更検出は無効になります。"true"に設定すると、基本的な名前変更検出が有効になります。デフォルトはdiff.renamesの値です。

merge.renormalize

Tell Git that canonical representation of files in the repository has changed over time (e.g. earlier commits record text files with CRLF line endings, but recent ones use LF line endings). In such a repository, Git can convert the data recorded in commits to a canonical form before performing a merge to reduce unnecessary conflicts. For more information, see section "Merging branches with differing checkin/checkout attributes" in gitattributes[5].リポジトリ内のファイルの正規表現が時間の経過とともに変化したことをGitに伝えます(例えば、以前のコミットはCRLF行末を持つテキストファイルを記録しましたが、最近のコミットはLF行末を使います)。そのようなリポジトリでは、Gitはマージを実行する前にコミットに記録されたデータを正規の形式に変換して不要な競合を減らすことができます。詳細については、gitattributes [5]の「異なるチェックイン/チェックアウト属性を持つブランチのマージ」節を参照してください。

merge.stat

Whether to print the diffstat between ORIG_HEAD and the merge result at the end of the merge. True by default.マージの最後にORIG_HEADとマージ結果の間のdiffstatを印刷するかどうか。デフォルトでは真です。

merge.tool

Controls which merge tool is used by git-mergetool[1]. The list below shows the valid built-in values. Any other value is treated as a custom merge tool and requires that a corresponding mergetool.<tool>.cmd variable is defined.git-mergetool [1]によって使用されるマージツールを制御します。以下のリストは有効な組み込み値を示しています。その他の値はカスタムマージツールとして扱われ、対応するmergetool。<tool> .cmd変数が定義されている必要があります。

merge.guitool

Controls which merge tool is used by git-mergetool[1] when the -g/--gui flag is specified. The list below shows the valid built-in values. Any other value is treated as a custom merge tool and requires that a corresponding mergetool.<guitool>.cmd variable is defined.-g / - guiフラグが指定されているときに、どのマージツールがgit-mergetool [1]によって使用されるかを制御します。以下のリストは有効な組み込み値を示しています。その他の値はカスタムマージツールとして扱われ、対応するmergetool。<guitool> .cmd変数が定義されている必要があります。

  • araxisアラクシス

  • bc紀元前

  • bc3BC3

  • codecompareコード比較

  • deltawalkerデルタウォーカー

  • diffmerge拡散する

  • diffuse拡散する

  • ecmergeエマージ

  • emerge出現する

  • examdiffExdiff

  • guiffyギフイ

  • gvimdiff

  • gvimdiff2

  • gvimdiff3

  • kdiff3

  • meld溶ける

  • opendiffOpenndiff

  • p4merge

  • tkdiff

  • tortoisemergeべっ甲

  • vimdiffビムディフ

  • vimdiff2

  • vimdiff3

  • winmerge勝ち

  • xxdiff

merge.verbosity

Controls the amount of output shown by the recursive merge strategy. Level 0 outputs nothing except a final error message if conflicts were detected. Level 1 outputs only conflicts, 2 outputs conflicts and file changes. Level 5 and above outputs debugging information. The default is level 2. Can be overridden by the GIT_MERGE_VERBOSITY environment variable.再帰的マージ戦略によって表示される出力の量を制御します。競合が検出された場合、レベル0は最後のエラーメッセージ以外は何も出力しません。レベル1は競合のみを出力し、2は競合とファイル変更を出力します。レベル5以上はデバッグ情報を出力します。デフォルトはレベル2 GIT_MERGE_VERBOSITYです。環境変数によってオーバーライドすることができます。

merge.<driver>.name マージします。

Defines a human-readable name for a custom low-level merge driver. See gitattributes[5] for details.カスタムの低レベルのマージドライバのための人間が読める名前を定義します。詳細はgitattributes [5]を見てください。

merge.<driver>.driver マージします。<driver> .driver

Defines the command that implements a custom low-level merge driver. See gitattributes[5] for details.カスタムの低レベルマージドライバを実装するコマンドを定義します。詳細はgitattributes [5]を見てください。

merge.<driver>.recursive マージします。

Names a low-level merge driver to be used when performing an internal merge between common ancestors. See gitattributes[5] for details.共通の先祖間で内部マージを実行するときに使用される低レベルのマージドライバを指定します。詳細はgitattributes [5]を見てください。

branch.<name>.mergeOptions branch。<名前> .mergeOptions

Sets default options for merging into branch <name>. The syntax and supported options are the same as those of git merge, but option values containing whitespace characters are currently not supported.ブランチ<名前>にマージするためのデフォルトオプションを設定します。構文とサポートされているオプションはgit mergeと同じですが、空白文字を含むオプション値は現在サポートされていません。

SEE ALSO関連項目

git-fmt-merge-msg[1], git-pull[1], gitattributes[5], git-reset[1], git-diff[1], git-ls-files[1], git-add[1], git-rm[1], git-mergetool[1]git-fmt-merge-msg [1]git-pull [1]gitattributes [5]git-reset [1]git-diff [1]git-lsファイル[1]git-add [ 1] 1]git-rm [1]git-mergetool [1]

GIT

Part of the git[1] suite一部のgit [1]スイート

関連記事

スポンサーリンク

データベースを定時バックアップする方法(毎日バックアップする処理)

ホームページ製作・web系アプリ系の製作案件募集中です。

上に戻る