Surley (?) the simplest method, given your limited number of branches, is to capture and repeat the moves as a script once for each branch, so that each branch has a flag day commit. Then the development merging should proceed just fine.

At least then the file rename machinery has much less to worry about for any (real) conflicts that may happen. It will normally show the file renames just in case..


Philip

----- Original Message ----- From: "Carsten Fuchs" <carsten.fu...@cafu.de>
To: <git-users@googlegroups.com>
Sent: Sunday, January 06, 2013 12:43 PM
Subject: [git-users] Problem with moving everything into a subdirectory; merge conflicts


Hi all,

we have a repository with essentially this commit graph:


       o---o---o---...---o---o---D   <-- develop
      /       /         /
 o---o---o---o---...---M             <-- master


As shown, we occasionally merge "master" into "develop", but never vice-versa. (We
create our releases off the "develop" branch, not "master".)

Now we have found a need to reorganize our files and directories, moving "everything"
into a new subdirectory "www", for example like this:

    # Git version is 1.7.11.msysgit.1 on Windows 7.
    # At the top of the working tree:
    mkdir www/

    git mv forum/ www/
    git mv images/ www/
    git mv templates/ www/
    git mv index.php www/
    ...

    git commit -m "Moved everything into www/."

This is easy, but the problem is that we eventually have to do this *both* in "develop" *and* in "master", in order to be able to do future merges from "master" into "develop"
as before.

The question is how?

I tried the above move-and-commit commands first at commit M, yielding new commit N,
then to merge this into "develop" in order to obtain E:


       o---o---o---...---o---o---D ---E    <-- develop
      /       /         /            /
 o---o---o---o---...---M -----------N      <-- master


but this yields plenty of merge conflicts, probably because D has several files in various directories that M doesn't have, and several files with small changes as well.

So I deleted E again (reset "develop" back to D), repeated the above move-and-commit commands at D in order to mimic things in the "develop" branch, obtaining F, and *then*
tried to merge "master" into "develop" to obtain G:


       o---o---o---...---o---o---D ---F ---G   <-- develop
      /       /         /                 /
 o---o---o---o---...---M -----------N ---ยด     <-- master


To my surprise, this caused conflicts for quasi every of the affected 11000 files as well. Unfortunately I didn't keep a copy of the exact messages, but essentially the reported conflict was that the file has been renamed on one side, and has been renamed
on the other side as well.


What can we do?

Best regards,
Carsten



--
   Cafu - the open-source Game and Graphics Engine
for multiplayer, cross-platform, real-time 3D Action
          Learn more at http://www.cafu.de

--




-----
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2013.0.2805 / Virus Database: 2637/6011 - Release Date: 01/05/13


--


Reply via email to