From: Holger Hellmuth Date: Tue, 22 Nov 2011 15:08:04 GMT Subject: Re: How to deal with mixed tree? Message-ID: <4ECBBAD4.6080206@ira.uka.de> In-Reply-To: <4ECBAFB7.9040505@obry.net> On 22.11.2011 15:20, Pascal Obry wrote: > > Holger, > >> Remove SD in P1, make a logical link from P2 to SD, add SD to >> .git/info/exclude > > Thanks for your quick reply. That's what I have tested but... > >> (see "Bug report - local (and git ignored) file silently removed after >> checkout" on the mailing list why exclude is better than .gitignore at >> the moment) > > Seems like this is working only if file names are different. This is not > my case as the replacement is very similar. With the following script > I'm expecting empty status and no diff: > > << > #!/bin/sh > > # create sd (directory that will replace src2) > mkdir sd > echo sd1> sd/file1 > echo sd2> sd/file2 > > # create Git repo > mkdir repo > cd repo > git init > mkdir src1 > mkdir src2 > echo file> src1/file > echo 3> src2/file3 > git add . > git ci -a -m "first" > > # let's replace src2 by sd > > rm -fr src2 > # ln -s ../sd src2 > cp -r ../sd src2 > > # make sure src2 is excluded > > echo 'src2/*'>> .git/info/exclude > > # the following output should be clean You should also remove src2 and all files in it from the git repository. Something like git rm -r src2 git ci echo 'src2' >> .git/info/exclude instead of rm -fr src2 echo 'src2/*' >> .git/info/exclude