git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Santi Béjar" <santi@agolina.net>
To: Thomas Rast <trast@student.ethz.ch>
Cc: jemmyw <jeremy@boost.co.nz>, git@vger.kernel.org
Subject: Re: retrospective move
Date: Wed, 4 Feb 2009 11:31:43 +0100	[thread overview]
Message-ID: <adf1fd3d0902040231h2fb6f199oee143e36a7501a2a@mail.gmail.com> (raw)
In-Reply-To: <200902041017.47564.trast@student.ethz.ch>

2009/2/4 Thomas Rast <trast@student.ethz.ch>:
> 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

  reply	other threads:[~2009-02-04 10:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-04  8:43 retrospective move jemmyw
2009-02-04  9:17 ` Thomas Rast
2009-02-04 10:31   ` Santi Béjar [this message]
2009-02-04 12:33     ` Thomas Rast
2009-02-04 12:57       ` Santi Béjar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=adf1fd3d0902040231h2fb6f199oee143e36a7501a2a@mail.gmail.com \
    --to=santi@agolina.net \
    --cc=git@vger.kernel.org \
    --cc=jeremy@boost.co.nz \
    --cc=trast@student.ethz.ch \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).