2

ファイル間で情報を移動するときに、VCS がひどいマージを行っているため、作業中のプロジェクトに大混乱が生じています。

したがって、シナリオは次のとおりです。

たとえば、辞書の用語に関する情報を含むファイルがたくさんあるので、アルファベットの各文字のファイルがあります。

用語を入力するユーザーはやみくもに辞書の順序に従います。そのため、たまたま辞書にリストされていた場合は、B の下に「バケツを蹴る」などのエントリを配置します (または、B のバケツと K のキックの両方にリストされていた可能性があります)。 .

後で、他のユーザーが用語を正しいファイルに移動します。辞書用語に関しては、常に多くの作業が行われています。

たとえば、ユーザー A は B ファイルを取得し、「バケツを蹴る」エントリについて詳しく説明した可能性があります。ユーザー B は B ファイルと K ファイルを取得し、「kick the bucket」エントリを K ファイルに移動しました。最終的にどの順序でコミットされても、VCS はおそらくエントリを失い、エントリが移動されたことを「認識」しません。

(これらのエントリは、後で自動的に SQL データベースに変換されます。しかし、それらは、多くのコメントや例などとともに、"人間に優しい" 形式で作業できるように保持されます。したがって、「ユーザーに直接 SQL を入力させる」ということは受け入れられません。 ".)

VCS を信頼できないため、これらの種類のファイルをほとんど手動でマージするようになったのは非常に残念です。:(

それで、解決策は何ですか?これに対処できる VCS があることを知りたいです。またはより良いマージアルゴリズム? または、誰かがこの問題を回避するためのより良いワークフローまたはファイル配置を提案できますか?

4

1 に答える 1

4

私がお勧めします:

  • 分岐の使用 (この方法では、コミットの順序は重要ではありません。各開発者は、自分のブランチに独自の変更セットを記録します)
  • 競合を解決できるメインの「dico」ブランチにブランチを統合します

Gitは特にこれが得意です)


すぐにテストできます:

C:\test\git>mkdir dico
C:\test\git>cd dico
C:\test\git\dico>git init
Initialized empty Git repository in C:/test/git/dico/.git/
C:\test\git\dico>echo words for B> B.txt
C:\test\git\dico>echo words for K> K.txt
C:\test\git\dico>git add -A & git commit -m "first letters"
[master (root-commit) e91d6fa] first letters
 2 files changed, 2 insertions(+), 0 deletions(-)
 create mode 100644 B.txt
 create mode 100644 K.txt

master ブランチに空の dico があります。
DevA が登場:

C:\test\git\dico>git checkout -b devA
Switched to a new branch 'devA'
C:\test\git\dico>echo Kick the Bucket: my def from devA>>B.txt
C:\test\git\dico>type B.txt
words for B
Kick the Bucket: my def from devA
C:\test\git\dico>git add -A & git commit -m "def from devA"
[devA 0f27595] def from devA
 1 files changed, 1 insertions(+), 0 deletions(-)

DevB が登場し、devA の作業を取得します。

C:\test\git\dico>git checkout master
Switched to branch 'master'
C:\test\git\dico>type B.txt
words for B
C:\test\git\dico>git checkout -b devB
Switched to a new branch 'devB'
C:\test\git\dico>git merge devA
Updating e91d6fa..0f27595
Fast forward
 B.txt |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

C:\test\git\dico>type B.txt
words for B
Kick the Bucket: my def from devA

大野!この定義の場所が間違っています!

C:\test\git\dico>echo words for B>B.txt
C:\test\git\dico>echo Kick the Bucket: my def from devA>>K.txt
C:\test\git\dico>git add -A & git commit -m "move def to K by devB"
[devB 473614d] move def to K by devB
 2 files changed, 1 insertions(+), 1 deletions(-)

devB ブランチで修正します。DevB は次のように続けます。

C:\test\git\dico>echo add to def by devB>>K.txt
C:\test\git\dico>git add -A & git commit -m "elaborate def by devB on K"
[devB f9ae17d] elaborate def by devB on K
 1 files changed, 1 insertions(+), 0 deletions(-)

つまり、devA ブランチでは、devA もこの定義に取り組んでいます。

C:\test\git\dico>git checkout devA
Switched to branch 'devA'
C:\test\git\dico>type B.txt
words for B
Kick the Bucket: my def from devA
C:\test\git\dico>type K.txt
words for K

C:\test\git\dico>B>>B.txt の devA から elabore def をエコー

C:\test\git\dico>type B.txt
words for B
Kick the Bucket: my def from devA
elabore def from devA in B

C:\test\git\dico>git add -A & git commit -m "devA go on on B.txt"
[devA 1da899a] devA go on on B.txt
 1 files changed, 1 insertions(+), 0 deletions(-)

devB が devA の作業をチェックすると、競合が検出され、適切に解決されます。

C:\test\git\dico>git checkout devB
Switched to branch 'devB'

C:\test\git\dico>git merge devA
Auto-merging B.txt
CONFLICT (content): Merge conflict in B.txt
Automatic merge failed; fix conflicts and then commit the result.

C:\test\git\dico>git diff
diff --cc B.txt
index 1cc6ea9,a986721..0000000
--- a/B.txt
+++ b/B.txt
@@@ -1,1 -1,3 +1,6 @@@
  words for B
++<<<<<<< HEAD
++=======
+ Kick the Bucket: my def from devA
+ elabore def from devA in B
++>>>>>>> devA

彼は B.txt から余分な定義を削除し、それを K.txt に追加します (そして、devA に行き、停止し、作業をマージし、正しいファイルで続行するように指示します!)

于 2009-09-22T09:05:29.603 に答える