Re: git and bzr

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Nicholas Allen wrote:

>> Just out of curiosity: How does git handle the case where one file is
>> renamed differently in 2 branches and then the branches are repeatably
>> merged? I know that bzr handles this very well and in various tests I
>> did there were absolutely no repeated conflicts. Would git behave as
>> well in this scenario?
>> 
> 
> Ok - I got curious and decided to install git and try this myself.
> 
> In this test I had a file hello.txt that got renamed to hello1.txt in
> one branch and hello2.txt in another. Then I merged the changes between
> the 2 branches.
> 
> Here is how it looked after the merge in bzr:
> 
>  bzr status
> renamed:
>   hello2.txt => hello1.txt
> conflicts:
>   Path conflict: hello2.txt / hello1.txt
> pending merges:
>   Nicholas Allen 2006-11-28 Renamed hello to hello1
> 
> 
> and here's how it looked in git:
> git status
> #
> # Changed but not updated:
> #   (use git-update-index to mark for commit)
> #
> #       unmerged: hello.txt
> #       unmerged: hello1.txt
> #       unmerged: hello2.txt
> #       modified: hello2.txt
> #
> nothing to commit

Er? What about merge printed?

  $ git pull . branch
  Trying really trivial in-index merge...
  fatal: Merge requires file-level merging
  Nope.
  Merging HEAD with c59706ee42aa7b6b2b203d4219210a684f5581f2
  Merging:
  8f43c37 Moved hello.txt to hello_master.txt
  c59706e Moved hello.txt to hello_branch.txt
  found 1 common ancestor(s):
  b7d5f1a Initial commit
  CONFLICT (rename/rename): Rename hello.txt->hello_master.txt in branch 
    HEAD rename hello.txt->hello_branch.txt in c59706e
  Automatic merge failed; fix conflicts and then commit the result.

I agree that git-status output could be more helpful in the case of
merges. Well, you can always check "git ls-files --stage"

  $ git ls-files --stage --abbrev
  100644 18249f3 1        hello.txt
  100644 18249f3 3        hello_branch.txt
  100644 18249f3 2        hello_master.txt

> So git is not telling me that I have a conflict due to the same file
> being renamed differently in 2 branches - well at least not in a way I
> can comprehend anyway! Whereas bzr made this very clear. Also, in git I
> ended up with 2 files:
> 
>  ls
> hello1.txt  hello2.txt
> 
> whereas in bzr there was only one file and I just had to decide which
> name it was to be given to resolve the conflict.

-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git


-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]