Re: retrospective move

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

 



2009/2/4 Thomas Rast <trast@xxxxxxxxxxxxxxx>:
> jemmyw wrote:
>>
>> Hi. Awhile ago I copied some files in my local repo then commited. In another
>> commit I deleted the original files, so essentially I did a mv that git
>> doesn't know about. Now I'm trying to merge from another branch where
>> changes have happened to the files in their original locations, and it's
>> making the merge somewhat difficult. Is there a way to ease this?
>
> Git never "knows" about a move, it only detects them after the fact.
> A corollary of this is that 'git mv a b' is more or less the same as
> 'cp a b; git rm a; git add b'.
>
> Now since you have a copy followed by a removal in two separate
> commits, the merge logic won't treat this as a rename.

I don't think it holds. Git only sees the endpoints and the bases, it
does not matter if the "move" was actually two commits. Maybe they
have changed dramatically and git is not able to detect the rename (or
the files are small). Another possible cause could be that you have a
lot of renames (see config merge.renamelimit).

You could see if git detects the rename diffing differents commits:

$ git diff --raw -M commit1 commit2

if it does not detect you could use other limits as:

$ git diff --raw -M50 commit1 commit2

while commit1 and 2 are the endpoints or the merge base.

It could hep if you could provide a minimal test case, or at least the
commands and output you get.

HTH,
Santi
--
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]

  Powered by Linux