1つのブランチでファイル名を変更しました。 他の支店でファイルを移動しました。 masterブランチと両方のブランチをマージしました。 これで、masterブランチに2つのファイルがあり、マージ時に競合が発生しません。 Gitはそのように振る舞いますか?私は少なくとも警告を期待する。移動してファイル名を変更しました
編集:コンソールが私に警告を与えます。だからそれは問題ではない。 (Egitはeclipseプラグインです)
1つのブランチでファイル名を変更しました。 他の支店でファイルを移動しました。 masterブランチと両方のブランチをマージしました。 これで、masterブランチに2つのファイルがあり、マージ時に競合が発生しません。 Gitはそのように振る舞いますか?私は少なくとも警告を期待する。移動してファイル名を変更しました
編集:コンソールが私に警告を与えます。だからそれは問題ではない。 (Egitはeclipseプラグインです)
git mv
なしでファイルの名前を変更したため、動作は正常です。 gitは正しくファイル名の変更を検出しましたが、古いファイルの削除はコミットしませんでした。
git mv
またはmv
の後にgit rm oldfile
を使用すると、正しくマージの競合が発生します。
Initialized empty Git repository
$ echo "hello" > hello.txt
$ git add hello.txt && git commit -m "first"
[master (root-commit) 708ec5f] first
1 file changed, 1 insertion(+)
create mode 100644 hello.txt
$ git branch mybranch
$ git mv hello.txt hello2.txt
$ git commit -m "renamed"
[master 00c68ed] renamed
1 file changed, 0 insertions(+), 0 deletions(-)
rename hello.txt => hello2.txt (100%)
$
$ git checkout mybranch
Switched to branch 'mybranch'
$ mkdir test
$ git mv hello.txt test
$ git commit -m "moved"
[mybranch 044e091] moved
1 file changed, 0 insertions(+), 0 deletions(-)
rename hello.txt => test/hello.txt (100%)
$ git checkout master
Switched to branch 'master'
$ git merge mybranch
CONFLICT (rename/rename): Rename "hello.txt"->"hello2.txt" in branch "HEAD" rename "hello.txt"->"test/hello.txt" in "mybranch"
Automatic merge failed; fix conflicts and then commit the result.
いいえ、git mvを使用していないとは関係ありません。 git mvを使うと同じ結果が得られます。 – user482745
私のためではありません。 'mv'でも古いファイルを' git rm'しないと、後者はそのまま残ります。私はここで単純なケースを再現し、マージコンフリクトを取得しました。 – CharlesB
あなたが記述したケース(あるブランチに移動し、他のブランチに移動して、別のブランチに移動してマージ)に続いて、テストレポのトランスクリプトを参照してください。私は正しくマージの競合を得る – CharlesB
'git mv'を使用しましたか、シェルコマンドを使用してファイルの名前を変更/移動しましたか? –
シェルを使用しました。 [リンク](http://stackoverflow.com/questions/1094269/whats-the-purpose-of-git-mv)によると問題ではありません。 – user482745
あなたがリンクした質問の回答には、(git mvを参照して)コメントがあります:「これにはいくつかの安全機能が組み込まれています。たぶんこれはケースの1つですか? – Edu