Hi Joe, Thanks for your response. As I mentioned earlier, I realize submodules might be the way to go for this kind of setup. However, what I am getting at is, if we have or had a git repo within another git repo, GIT is somehow getting confused or losing track about the child repo/folder.
This is the continuation script or second part of test case I mentioned in the previous email. I'll wipe off everything from "Child1Repo" and try adding it as a simple folder. $ rm -rf Child1Repo/ $ mkdir Child1Repo/ $ cd Child1Repo/ $ echo "New file in Child1Repo" > NewFileInChild1Repo.txt $ git add . $ cd .. $ git status # On branch master nothing to commit (working directory clean) So, the Parent1GITRepo doesn't honor anything in "Child1Repo" folder anymore even if it is not a repo. I tried "git clean -n -d -x", no help. Obviously, I could rename Child1Repo & workaround this issue. But, what I am wondering is, is this the default behaviour or a bug waiting to be discovered? Thanks, On Apr 22, 12:34 pm, Joe Hassick <ehass...@gmail.com> wrote: > If you want a repository within a repository, you will need to use > submodules. Without submodules, what you are explaining will always happen > (missing everything from the child repo after cloning the parent). > > Read over these if you need some references/an introduction to using > submodules:https://git.wiki.kernel.org/index.php/GitSubmoduleTutorialhttp://blog.zarate.tv/2010/10/05/working-with-git-submodules > > HTH, > > Joe > > > > > > > > > > On Fri, Apr 22, 2011 at 12:55 PM, siddii <sid...@gmail.com> wrote: > > I don't want to categorize this as bug until I hear expert panel's > > opinion. Spare me if its a known issue or if I am doing something > > silly :) I did enough research online and couldn't find a good answer. > > > Here it goes.. > > > Let's say if I have a folder called "ParentGITRepo" which is a local > > GIT repo. I have sub folders called "Child1Repo" and "Child2" with > > some files on it. For some reason, whether accidentally or > > deliberately, I make "Child1Repo" a GIT repo on its own. GIT > > recognizes ParentGITRepo & Child1Repo as separate GIT repositories. > > But, if I clone "ParentGITRepo" into somewhere else, I am missing > > everything from Child1Repo. The worse thing is, even if I cleanup > > "Child1Repo" by removing it's .git folder, the parent GIT repo is > > ignoring any activity I do in that folder. > > > I think, the right way to do this setup is probably using git sub > > modules or something. But given this scenario, what is the expected > > behaviour? Am i missing? It would really make more sense if you can go > > thro the following steps (test cases) outlined below. > > > # Setting up ParentGITRepo & Child1Repo and Child2 > > $ cd ~ > > $ mkdir ParentGITRepo > > $ cd ParentGITRepo/ > > $ git init . > > $ mkdir Child1Repo > > $ mkdir Child2 > > $ cd Child1Repo/ > > $ git init . > > $ echo "Child1RepoFile" > Child1RepoFile.txt > > $ git add . > > $ git commit -a -m "Adding Child1Repo content" > > [master (root-commit) 01ccc52] Adding Child1Repo content > > 1 files changed, 1 insertions(+), 0 deletions(-) > > create mode 100644 Child1RepoFile.txt > > > $ cd ../Child2/ > > $ echo "Child2 file content" > Child2File.txt > > $ cd .. > > $ echo "Parentfile" > ParentFile.txt > > $ git add . > > $ git commit -a -m "Adding Parent content" > > [master (root-commit) b31d0a5] Adding Parent content > > 3 files changed, 3 insertions(+), 0 deletions(-) > > create mode 160000 Child1Repo > > create mode 100644 Child2/Child2File.txt > > create mode 100644 ParentFile.txt > > > --------------------------------------- > > # Now verify ParentGITRepo & Child1Repo working independently > > $ cd ~/ParentGITRepo/ > > $ git log > > commit b31d0a5aef19c6b119d89718f560905ad0f34aa7 > > Author: Siddique Hameed <siddii+...@gmail.com> > > Date: Fri Apr 22 11:25:15 2011 -0500 > > > Adding Parent content > > > $ cd ~/ParentGITRepo/Child1Repo/ > > $ git log > > commit 01ccc52931f8b40f6d92b29769300a254d8dd411 > > Author: Siddique Hameed <siddii+...@gmail.com> > > Date: Fri Apr 22 11:22:00 2011 -0500 > > > Adding Child1Repo content > > > -------------------------------------------- > > > # Now try cloning ParentGITRepo & verify the contents inside it > > $ cd ~ > > $ git clone ParentGITRepo/ ParentGITRepoClone/ > > Cloning into ParentGITRepoClone... > > done. > > $ cd ParentGITRepoClone/ > > $ ls -a > > ./ ../ .git/ Child1Repo/ Child2/ ParentFile.txt > > > $ cd Child1Repo/ > > $ ls -a > > ./ ../ > > > $ git log > > commit b31d0a5aef19c6b119d89718f560905ad0f34aa7 > > Author: Siddique Hameed <siddii+...@gmail.com> > > Date: Fri Apr 22 11:25:15 2011 -0500 > > > Adding Parent content > > > -------------------------------------------- > > > As you can see there is nothing in Child1Repo after its was cloned. I > > also tried the reverse of this. Like, having a child folder as GIT > > repo and make a ParentFolder a repo on its own & clone the parent > > folder and the cloned folder doesnt contain anything from child repo. > > > Let me know if you have more questions. > > > Thanks, > > > -- > > You received this message because you are subscribed to the Google Groups > > "Git for human beings" group. > > To post to this group, send email to git-users@googlegroups.com. > > To unsubscribe from this group, send email to > > git-users+unsubscr...@googlegroups.com. > > For more options, visit this group at > >http://groups.google.com/group/git-users?hl=en. > > -- > Joe Hassick -- You received this message because you are subscribed to the Google Groups "Git for human beings" group. To post to this group, send email to git-users@googlegroups.com. To unsubscribe from this group, send email to git-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/git-users?hl=en.