我怎样才能重现这些git冲突?

时间:2014-08-07 03:17:22

标签: git tree-conflict

我不明白added by themadded by us会如何导致冲突,

有谁知道如何重现这些冲突?

1 个答案:

答案 0 :(得分:1)

您似乎在描述(according to Github移动 - 移动冲突。

以下是它如何下降。

你有两个开发人员,亚当和鲍勃。 Adam看到一个名为tax_db.txt的资源文件,并确定该文件名称错误 - 它只是一个制表符分隔的文件 - 因此他将其重命名为“更好”的内容,如tax_file.txt

鲍勃看到同一个文件,并判断它的名字也错了,但不喜欢把它称为文件的想法;它真的更像是一个参考。因此,他将文件命名为tax_reference_chart.txt

他们都有自己的分支master(为了简单起见,A和B),他们正在愉快地忘记彼此的变化,导致项目变得与众不同另一个。

当发布经理Makoto想要合并Adam和Bob的分支时,他会遇到这种冲突。

makoto@workspace:~/foo$ git merge A
Updating d2cfb22..a512859
Fast-forward
 tax_db.txt => tax_file.txt | 0
 1 file changed, 0 insertions(+), 0 deletions(-)
 rename tax_db.txt => tax_file.txt (100%)
makoto@workspace:~/foo$ git merge B
CONFLICT (rename/rename): Rename "tax_db.txt"->"tax_file.txt" in branch "HEAD" rename "tax_db.txt"->"tax_reference_chart.txt" in "B"
Automatic merge failed; fix conflicts and then commit the result.
makoto@workspace:~/foo$ git status
On branch master
You have unmerged paths.
  (fix conflicts and run "git commit")

Unmerged paths:
  (use "git add/rm <file>..." as appropriate to mark resolution)

    both deleted:       tax_db.txt
    added by us:        tax_file.txt
    added by them:      tax_reference_chart.txt

no changes added to commit (use "git add" and/or "git commit -a")

那时,它基本上是亚当和鲍勃的办公桌之旅,听取有关为什么他们重​​命名文件是合理的论点。