I don't understand how added by them
and added by us
can cause conflict,
does anyone know how to reproduce these conflicts?
It looks like you're describing (according to Github) a move-move conflict.
Here's how it goes down.
You have two developers, Adam and Bob. Adam sees a resource file called tax_db.txt
and decides that the file is misnamed - it's just a tab-delimited file - so he renames it to something "better", like tax_file.txt
.
Bob sees the same file, and decides that it's misnamed too, but doesn't like the idea of calling it a file; it's really more of a reference. So, he names the file to tax_reference_chart.txt
.
They've both got their own branch off of master
(for simplicity's sake, A and B), and they're working happily oblivious to one another's changes, which have caused the project to become divergent from one another.
When Makoto, the release manager, wants to merge Adam and Bob's branches in, he would get this conflict.
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")
At that point, it's basically a trip over to Adam and Bob's desk to hear arguments as to why their rename of the file was justified.