git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: How to deal with mixed tree?

From
Pascal Obry <pascal@obry.net>
Date
Nov 22, 2011, 15:21 UTC
Message-ID
<4ECBBDE3.3010904@obry.net>
In-Reply-To
<4ECBBAD4.6080206@ira.uka.de>
Holger,
Show 11 quoted lines
> 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
Thanks this is working indeed. But it was not the whole story :)

In fact I want to do that in a branch (say work) and keep master as-is as this branch is used to pull changes from origin. And in this case, doing 'git diff master' still shows the files under src2. See script to reproduce:

<< #!/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 in branch work

git checkout -b work git rm src2/* git ci -m "no more 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

echo '============== Status' git status

echo '============== Diff' git diff

echo '============== Diff master' git diff master

>>
Is that possible?
-- 
--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|    http://www.obry.net  -  http://v2p.fr.eu.org
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver keys.gnupg.net --recv-key F949BD3B
Previous: Holger HellmuthNext: Holger Hellmuth
Message 5 of 8 in “How to deal with mixed tree?”
  1. Pascal ObryNov 22, 2011
  2. Holger HellmuthNov 22, 2011
  3. Pascal ObryNov 22, 2011
  4. Holger HellmuthNov 22, 2011
  5. Pascal ObryNov 22, 2011
  6. Holger HellmuthNov 22, 2011
  7. Pascal ObryNov 22, 2011
  8. Junio C HamanoNov 22, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.