{"thread":{"id":"27165","subject":"GIT cloning(or pull/push) doesn't work properly if you have a sub-folder as its own GIT repo","startedAt":"2011-04-23T17:04:40Z","lastAt":"2011-04-25T22:34:13Z","messageCount":5,"participants":["Siddique Hameed","Chris Packham","Tor Arntsen"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"166269","messageId":"BANLkTi=YsEr9hOz7-u_t3BJUiMt+34P+ZA@mail.gmail.com","threadId":"27165","inReplyTo":null,"subject":"GIT cloning(or pull/push) doesn't work properly if you have a sub-folder as its own GIT repo","fromName":"Siddique Hameed","fromEmail":"siddii@gmail.com","sentAt":"2011-04-23T17:04:40Z","receivedAt":"2011-04-23T17:04:40Z","isPatch":false,"sender":{"key":"siddii@gmail.com","avatar":null},"body":"I don't want to categorize this as bug until I hear expert panel's\nopinion. Spare me if its a known issue or if I am doing something\nsilly :) I did enough research online and couldn't find a good answer.\n\nHere it goes..\n\nLet's say if I have a folder called \"ParentGITRepo\" which is a local\nGIT repo. I have sub folders called \"Child1Repo\" and \"Child2\" with\nsome files on it. For some reason, whether accidentally or\ndeliberately, I make \"Child1Repo\" a GIT repo on its own. GIT\nrecognizes ParentGITRepo & Child1Repo as separate GIT repositories.\nBut, if I clone \"ParentGITRepo\" into somewhere else, I am missing\neverything from Child1Repo. The worse thing is, even if I cleanup\n\"Child1Repo\" by removing it's .git folder, the parent GIT repo is\nignoring any activity I do in that folder.\n\nI think, the right way to do this setup is probably using git sub\nmodules or something. But given this scenario, what is the expected\nbehaviour? Am i missing? It would really make more sense if you can go\nthro the following steps (test cases) outlined below.\n\n\n# Setting up ParentGITRepo & Child1Repo and Child2\n$ cd ~\n$ mkdir ParentGITRepo\n$ cd ParentGITRepo/\n$ git init .\n$ mkdir Child1Repo\n$ mkdir Child2\n$ cd Child1Repo/\n$ git init .\n$ echo \"Child1RepoFile\" > Child1RepoFile.txt\n$ git add .\n$ git commit -a -m \"Adding Child1Repo content\"\n[master (root-commit) 01ccc52] Adding Child1Repo content\n 1 files changed, 1 insertions(+), 0 deletions(-)\n create mode 100644 Child1RepoFile.txt\n\n$ cd ../Child2/\n$ echo \"Child2 file content\" > Child2File.txt\n$ cd ..\n$ echo \"Parentfile\" > ParentFile.txt\n$ git add .\n$ git commit -a -m \"Adding Parent content\"\n[master (root-commit) b31d0a5] Adding Parent content\n 3 files changed, 3 insertions(+), 0 deletions(-)\n create mode 160000 Child1Repo\n create mode 100644 Child2/Child2File.txt\n create mode 100644 ParentFile.txt\n\n---------------------------------------\n # Now verify ParentGITRepo & Child1Repo working independently\n$ cd ~/ParentGITRepo/\n$ git log\ncommit b31d0a5aef19c6b119d89718f560905ad0f34aa7\nAuthor: Siddique Hameed <siddii+git@gmail.com>\nDate:   Fri Apr 22 11:25:15 2011 -0500\n\n   Adding Parent content\n\n$ cd ~/ParentGITRepo/Child1Repo/\n$ git log\ncommit 01ccc52931f8b40f6d92b29769300a254d8dd411\nAuthor: Siddique Hameed <siddii+git@gmail.com>\nDate:   Fri Apr 22 11:22:00 2011 -0500\n\n   Adding Child1Repo content\n\n--------------------------------------------\n\n# Now try cloning ParentGITRepo & verify the contents inside it\n$ cd ~\n$ git clone ParentGITRepo/ ParentGITRepoClone/\nCloning into ParentGITRepoClone...\ndone.\n$ cd ParentGITRepoClone/\n$ ls -a\n./  ../  .git/  Child1Repo/  Child2/  ParentFile.txt\n\n$ cd Child1Repo/\n$ ls -a\n./  ../\n\n$ git log\ncommit b31d0a5aef19c6b119d89718f560905ad0f34aa7\nAuthor: Siddique Hameed <siddii+git@gmail.com>\nDate:   Fri Apr 22 11:25:15 2011 -0500\n\n   Adding Parent content\n\n--------------------------------------------\n\nAs you can see there is nothing in Child1Repo after its was cloned. I\nalso tried the reverse of this. Like, having a child folder as GIT\nrepo and make a ParentFolder a repo on its own & clone the parent\nfolder and the cloned folder doesnt contain anything from child repo.\n\nLet me know if you have more questions.\n\nThanks,\n\nSiddique\n"},{"id":"166274","messageId":"4DB3D863.4080500@gmail.com","threadId":"27165","inReplyTo":"BANLkTi=YsEr9hOz7-u_t3BJUiMt+34P+ZA@mail.gmail.com","subject":"Re: GIT cloning(or pull/push) doesn't work properly if you have a sub-folder as its own GIT repo","fromName":"Chris Packham","fromEmail":"judge.packham@gmail.com","sentAt":"2011-04-24T07:59:31Z","receivedAt":"2011-04-24T07:59:31Z","isPatch":false,"sender":{"key":"judge.packham@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155667?v=4"},"body":"On 24/04/11 05:04, Siddique Hameed wrote:\n> I don't want to categorize this as bug until I hear expert panel's\n> opinion. Spare me if its a known issue or if I am doing something\n> silly :) I did enough research online and couldn't find a good answer.\n\nNot exactly an expert but I'll try to help.\n\n> Here it goes..\n>\n> Let's say if I have a folder called \"ParentGITRepo\" which is a local\n> GIT repo. I have sub folders called \"Child1Repo\" and \"Child2\" with\n> some files on it. For some reason, whether accidentally or\n> deliberately, I make \"Child1Repo\" a GIT repo on its own. GIT\n> recognizes ParentGITRepo&  Child1Repo as separate GIT repositories.\n> But, if I clone \"ParentGITRepo\" into somewhere else, I am missing\n> everything from Child1Repo.\n\nThat's expected behaviour as far as I'm concerned (based on your \nexample). ParentGITRepo and Child1Repo are completely independent at \nthis point. Cloning ParentGITRepo won't get you any untracked files that \nhappen to be in the work-tree of the repository you're cloning.\n\n> The worse thing is, even if I cleanup\n> \"Child1Repo\" by removing it's .git folder, the parent GIT repo is\n> ignoring any activity I do in that folder.\n\nSo your options at this point are to make Child1Repo a submodule or to \nre-write ParentGITRepo and Child1Repo into a new repository combining \nthe history of both. Depending on your exact needs one option may be \nbetter than the other so do some more googling to find something that \nsuits your case.\n\n> I think, the right way to do this setup is probably using git sub\n> modules or something. But given this scenario, what is the expected\n> behaviour? Am i missing? It would really make more sense if you can go\n> thro the following steps (test cases) outlined below.\n>\n>\n> # Setting up ParentGITRepo&  Child1Repo and Child2\n> $ cd ~\n> $ mkdir ParentGITRepo\n> $ cd ParentGITRepo/\n> $ git init .\n> $ mkdir Child1Repo\n> $ mkdir Child2\n> $ cd Child1Repo/\n> $ git init .\n> $ echo \"Child1RepoFile\">  Child1RepoFile.txt\n> $ git add .\n> $ git commit -a -m \"Adding Child1Repo content\"\n\nAt this point you could have just treated Child1Repo as a normal \nsubdirectory. One thing some people struggle with is the fact that git \ndoesn't track empty directories, as soon as there a files in those \ndirectories it'll work just fine.\n\n> [master (root-commit) 01ccc52] Adding Child1Repo content\n>   1 files changed, 1 insertions(+), 0 deletions(-)\n>   create mode 100644 Child1RepoFile.txt\n>\n> $ cd ../Child2/\n> $ echo \"Child2 file content\">  Child2File.txt\n> $ cd ..\n> $ echo \"Parentfile\">  ParentFile.txt\n> $ git add .\n> $ git commit -a -m \"Adding Parent content\"\n> [master (root-commit) b31d0a5] Adding Parent content\n>   3 files changed, 3 insertions(+), 0 deletions(-)\n>   create mode 160000 Child1Repo\n>   create mode 100644 Child2/Child2File.txt\n>   create mode 100644 ParentFile.txt\n>\n> ---------------------------------------\n>   # Now verify ParentGITRepo&  Child1Repo working independently\n> $ cd ~/ParentGITRepo/\n> $ git log\n> commit b31d0a5aef19c6b119d89718f560905ad0f34aa7\n> Author: Siddique Hameed<siddii+git@gmail.com>\n> Date:   Fri Apr 22 11:25:15 2011 -0500\n>\n>     Adding Parent content\n>\n> $ cd ~/ParentGITRepo/Child1Repo/\n> $ git log\n> commit 01ccc52931f8b40f6d92b29769300a254d8dd411\n> Author: Siddique Hameed<siddii+git@gmail.com>\n> Date:   Fri Apr 22 11:22:00 2011 -0500\n>\n>     Adding Child1Repo content\n>\n> --------------------------------------------\n>\n> # Now try cloning ParentGITRepo&  verify the contents inside it\n> $ cd ~\n> $ git clone ParentGITRepo/ ParentGITRepoClone/\n> Cloning into ParentGITRepoClone...\n> done.\n> $ cd ParentGITRepoClone/\n> $ ls -a\n> ./  ../  .git/  Child1Repo/  Child2/  ParentFile.txt\n>\n> $ cd Child1Repo/\n> $ ls -a\n> ./  ../\n>\n> $ git log\n> commit b31d0a5aef19c6b119d89718f560905ad0f34aa7\n> Author: Siddique Hameed<siddii+git@gmail.com>\n> Date:   Fri Apr 22 11:25:15 2011 -0500\n>\n>     Adding Parent content\n>\n> --------------------------------------------\n>\n> As you can see there is nothing in Child1Repo after its was cloned. I\n> also tried the reverse of this. Like, having a child folder as GIT\n> repo and make a ParentFolder a repo on its own&  clone the parent\n> folder and the cloned folder doesnt contain anything from child repo.\n>\n> Let me know if you have more questions.\n>\n> Thanks,\n>\n> Siddique\n> --\n"},{"id":"166276","messageId":"4DB408C6.3080400@gmail.com","threadId":"27165","inReplyTo":"4DB3D863.4080500@gmail.com","subject":"Off-topic Thunderbird wrapping (was Re: GIT cloning(or pull/push) doesn't work properly if you have a sub-folder as its own GIT repo)","fromName":"Chris Packham","fromEmail":"judge.packham@gmail.com","sentAt":"2011-04-24T11:25:58Z","receivedAt":"2011-04-24T11:25:58Z","isPatch":false,"sender":{"key":"judge.packham@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155667?v=4"},"body":"On 24/04/11 19:59, Chris Packham wrote:\n>\n> That's expected behaviour as far as I'm concerned (based on your\n> example). ParentGITRepo and Child1Repo are completely independent at\n> this point. Cloning ParentGITRepo won't get you any untracked files that\n> happen to be in the work-tree of the repository you're cloning.\n\nSo this is the 2nd response I've sent recently that Thunderbird didn't \nwrap correctly (yet it looks fine in the composer). Can anybody tell me \n(or point me at a webpage) how to set it up to post to mailing lists nicely?\n"},{"id":"166278","messageId":"BANLkTim0TDf0+evU+zBf8fe0at7QQb5W0A@mail.gmail.com","threadId":"27165","inReplyTo":"4DB408C6.3080400@gmail.com","subject":"Re: Off-topic Thunderbird wrapping (was Re: GIT cloning(or pull/push) doesn't work properly if you have a sub-folder as its own GIT repo)","fromName":"Tor Arntsen","fromEmail":"tor@spacetec.no","sentAt":"2011-04-24T11:54:33Z","receivedAt":"2011-04-24T11:54:33Z","isPatch":false,"sender":{"key":"tor@spacetec.no","avatar":null},"body":"On Sun, Apr 24, 2011 at 13:25, Chris Packham <judge.packham@gmail.com> wrote:\n\n> So this is the 2nd response I've sent recently that Thunderbird didn't wrap\n> correctly (yet it looks fine in the composer). Can anybody tell me (or point\n> me at a webpage) how to set it up to post to mailing lists nicely?\n\nSee SubmittingPatches in the Git Documentation/ subdirectory (comes\nwith the distro).\nI used that to fix my own Thunderbird setup.\n\n-Tor\n"},{"id":"166337","messageId":"BANLkTik+CStXOOdk7JY6UmB0xDP+FKrEUA@mail.gmail.com","threadId":"27165","inReplyTo":"4DB3D863.4080500@gmail.com","subject":"Re: GIT cloning(or pull/push) doesn't work properly if you have a sub-folder as its own GIT repo","fromName":"Siddique Hameed","fromEmail":"siddii@gmail.com","sentAt":"2011-04-25T22:34:13Z","receivedAt":"2011-04-25T22:34:13Z","isPatch":false,"sender":{"key":"siddii@gmail.com","avatar":null},"body":"Hi Chris,\n\nThanks for your response. I figured out what I was doing wrong -\nhttp://groups.google.com/group/git-users/browse_thread/thread/d34523680b0ad093\n\nOn Sun, Apr 24, 2011 at 2:59 AM, Chris Packham <judge.packham@gmail.com> wrote:\n> On 24/04/11 05:04, Siddique Hameed wrote:\n>>\n>> I don't want to categorize this as bug until I hear expert panel's\n>> opinion. Spare me if its a known issue or if I am doing something\n>> silly :) I did enough research online and couldn't find a good answer.\n>\n> Not exactly an expert but I'll try to help.\n>\n>> Here it goes..\n>>\n>> Let's say if I have a folder called \"ParentGITRepo\" which is a local\n>> GIT repo. I have sub folders called \"Child1Repo\" and \"Child2\" with\n>> some files on it. For some reason, whether accidentally or\n>> deliberately, I make \"Child1Repo\" a GIT repo on its own. GIT\n>> recognizes ParentGITRepo&  Child1Repo as separate GIT repositories.\n>> But, if I clone \"ParentGITRepo\" into somewhere else, I am missing\n>> everything from Child1Repo.\n>\n> That's expected behaviour as far as I'm concerned (based on your example).\n> ParentGITRepo and Child1Repo are completely independent at this point.\n> Cloning ParentGITRepo won't get you any untracked files that happen to be in\n> the work-tree of the repository you're cloning.\n>\n>> The worse thing is, even if I cleanup\n>> \"Child1Repo\" by removing it's .git folder, the parent GIT repo is\n>> ignoring any activity I do in that folder.\n>\n> So your options at this point are to make Child1Repo a submodule or to\n> re-write ParentGITRepo and Child1Repo into a new repository combining the\n> history of both. Depending on your exact needs one option may be better than\n> the other so do some more googling to find something that suits your case.\n>\n>> I think, the right way to do this setup is probably using git sub\n>> modules or something. But given this scenario, what is the expected\n>> behaviour? Am i missing? It would really make more sense if you can go\n>> thro the following steps (test cases) outlined below.\n>>\n>>\n>> # Setting up ParentGITRepo&  Child1Repo and Child2\n>> $ cd ~\n>> $ mkdir ParentGITRepo\n>> $ cd ParentGITRepo/\n>> $ git init .\n>> $ mkdir Child1Repo\n>> $ mkdir Child2\n>> $ cd Child1Repo/\n>> $ git init .\n>> $ echo \"Child1RepoFile\">  Child1RepoFile.txt\n>> $ git add .\n>> $ git commit -a -m \"Adding Child1Repo content\"\n>\n> At this point you could have just treated Child1Repo as a normal\n> subdirectory. One thing some people struggle with is the fact that git\n> doesn't track empty directories, as soon as there a files in those\n> directories it'll work just fine.\n>\n>> [master (root-commit) 01ccc52] Adding Child1Repo content\n>>  1 files changed, 1 insertions(+), 0 deletions(-)\n>>  create mode 100644 Child1RepoFile.txt\n>>\n>> $ cd ../Child2/\n>> $ echo \"Child2 file content\">  Child2File.txt\n>> $ cd ..\n>> $ echo \"Parentfile\">  ParentFile.txt\n>> $ git add .\n>> $ git commit -a -m \"Adding Parent content\"\n>> [master (root-commit) b31d0a5] Adding Parent content\n>>  3 files changed, 3 insertions(+), 0 deletions(-)\n>>  create mode 160000 Child1Repo\n>>  create mode 100644 Child2/Child2File.txt\n>>  create mode 100644 ParentFile.txt\n>>\n>> ---------------------------------------\n>>  # Now verify ParentGITRepo&  Child1Repo working independently\n>> $ cd ~/ParentGITRepo/\n>> $ git log\n>> commit b31d0a5aef19c6b119d89718f560905ad0f34aa7\n>> Author: Siddique Hameed<siddii+git@gmail.com>\n>> Date:   Fri Apr 22 11:25:15 2011 -0500\n>>\n>>    Adding Parent content\n>>\n>> $ cd ~/ParentGITRepo/Child1Repo/\n>> $ git log\n>> commit 01ccc52931f8b40f6d92b29769300a254d8dd411\n>> Author: Siddique Hameed<siddii+git@gmail.com>\n>> Date:   Fri Apr 22 11:22:00 2011 -0500\n>>\n>>    Adding Child1Repo content\n>>\n>> --------------------------------------------\n>>\n>> # Now try cloning ParentGITRepo&  verify the contents inside it\n>> $ cd ~\n>> $ git clone ParentGITRepo/ ParentGITRepoClone/\n>> Cloning into ParentGITRepoClone...\n>> done.\n>> $ cd ParentGITRepoClone/\n>> $ ls -a\n>> ./  ../  .git/  Child1Repo/  Child2/  ParentFile.txt\n>>\n>> $ cd Child1Repo/\n>> $ ls -a\n>> ./  ../\n>>\n>> $ git log\n>> commit b31d0a5aef19c6b119d89718f560905ad0f34aa7\n>> Author: Siddique Hameed<siddii+git@gmail.com>\n>> Date:   Fri Apr 22 11:25:15 2011 -0500\n>>\n>>    Adding Parent content\n>>\n>> --------------------------------------------\n>>\n>> As you can see there is nothing in Child1Repo after its was cloned. I\n>> also tried the reverse of this. Like, having a child folder as GIT\n>> repo and make a ParentFolder a repo on its own&  clone the parent\n>> folder and the cloned folder doesnt contain anything from child repo.\n>>\n>> Let me know if you have more questions.\n>>\n>> Thanks,\n>>\n>> Siddique\n>> --\n>\n"}]}