{"thread":{"id":"31700","subject":"\"submodule\" mistake and a problem","startedAt":"2012-10-01T10:41:13Z","lastAt":"2012-10-01T21:16:18Z","messageCount":5,"participants":["Howard Miller","Johannes Sixt","Jens Lehmann"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"200253","messageId":"CAHVO_92=5u-i+-d__5k7Uoq5pF4iACq9GuBSj4U5MepbKV_jdA@mail.gmail.com","threadId":"31700","inReplyTo":null,"subject":"\"submodule\" mistake and a problem","fromName":"Howard Miller","fromEmail":"howardsmiller@gmail.com","sentAt":"2012-10-01T10:41:13Z","receivedAt":"2012-10-01T10:41:13Z","isPatch":false,"sender":{"key":"howardsmiller@gmail.com","avatar":"https://gravatar.com/avatar/e9a35d459ceb60f2244761bcc3d3bedfda40fa40dadbe8d440c6153d97eef6e2?d=mp&s=160"},"body":"Hi,\n\nI did this and now am confused/stuck...\n\n- I have an existing (long standing) project in git with an upstream in github\n- I added a subdirectory which I had forgotten was itself a git\nproject (i.e. it has its own .git directory)\n- I committed the subdirectory (git add /path/to/subdir;  git commit -m ....)\n- I pushed the latest version upstream\n\n....at this point I realised that only the directory name had been pushed. SO...\n\n- git rm /path/to/subdir resulted in fatal: pathspec\n'/path/to/subdir/' did not match any files\n- so I deleted it manually, re-copied the directory and removed its\n.git directory\n\n...I now cannot add or commit the directory. Git just ignores it. I\nhave grepped and searched and kind find no reference to this directory\nanywhere. I am completely stumped.\n\nCan anybody help? I don't want this to be a git subdirectory, I just\nwant to be able to add the files (without the .git directory)\n\nCheers :)\n"},{"id":"200254","messageId":"506981C1.3030504@viscovery.net","threadId":"31700","inReplyTo":"CAHVO_92=5u-i+-d__5k7Uoq5pF4iACq9GuBSj4U5MepbKV_jdA@mail.gmail.com","subject":"Re: \"submodule\" mistake and a problem","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2012-10-01T11:42:57Z","receivedAt":"2012-10-01T11:42:57Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 10/1/2012 12:41, schrieb Howard Miller:\n> - I have an existing (long standing) project in git with an upstream in github\n> - I added a subdirectory which I had forgotten was itself a git\n> project (i.e. it has its own .git directory)\n> - I committed the subdirectory (git add /path/to/subdir;  git commit -m ....)\n> - I pushed the latest version upstream\n> \n> .....at this point I realised that only the directory name had been pushed. SO...\n> \n> - git rm /path/to/subdir resulted in fatal: pathspec\n> '/path/to/subdir/' did not match any files\n> - so I deleted it manually, re-copied the directory and removed its\n> ..git directory\n> \n> ....I now cannot add or commit the directory. Git just ignores it. I\n> have grepped and searched and kind find no reference to this directory\n> anywhere. I am completely stumped.\n> \n> Can anybody help? I don't want this to be a git subdirectory, I just\n> want to be able to add the files (without the .git directory)\n\nPerhaps:\n\n  git rm -f --cached path/to/subdir   # remove from index, keep files\n  git add path/to/subdir\n\n-- Hannes\n"},{"id":"200255","messageId":"CAHVO_93d92Ert35z1popk+X8HAAHX_jwTVdRCjrhNHrhTsvx2Q@mail.gmail.com","threadId":"31700","inReplyTo":"506981C1.3030504@viscovery.net","subject":"Re: \"submodule\" mistake and a problem","fromName":"Howard Miller","fromEmail":"howardsmiller@gmail.com","sentAt":"2012-10-01T12:05:57Z","receivedAt":"2012-10-01T12:05:57Z","isPatch":false,"sender":{"key":"howardsmiller@gmail.com","avatar":"https://gravatar.com/avatar/e9a35d459ceb60f2244761bcc3d3bedfda40fa40dadbe8d440c6153d97eef6e2?d=mp&s=160"},"body":">\n> Perhaps:\n>\n>   git rm -f --cached path/to/subdir   # remove from index, keep files\n>   git add path/to/subdir\n>\n> -- Hannes\n\nFantastic.... worked perfectly.  I'll write that down somewhere for\nthe next time I do it :)\n\nIs there a better way of handling sub-modules like that? I've looked\nat git submodules but just got into more of a mess. It would be nice\nto push a project complete with a (git) submodule upstream but it\nseems tricky or impossible.\n\nThanks :)\n"},{"id":"200265","messageId":"5069C760.2020603@web.de","threadId":"31700","inReplyTo":"CAHVO_93d92Ert35z1popk+X8HAAHX_jwTVdRCjrhNHrhTsvx2Q@mail.gmail.com","subject":"Re: \"submodule\" mistake and a problem","fromName":"Jens Lehmann","fromEmail":"jens.lehmann@web.de","sentAt":"2012-10-01T16:40:00Z","receivedAt":"2012-10-01T16:40:00Z","isPatch":false,"sender":{"key":"jens.lehmann@web.de","avatar":"https://avatars.githubusercontent.com/u/135220?v=4"},"body":"Am 01.10.2012 14:05, schrieb Howard Miller:\n>>\n>> Perhaps:\n>>\n>>   git rm -f --cached path/to/subdir   # remove from index, keep files\n>>   git add path/to/subdir\n>>\n>> -- Hannes\n> \n> Fantastic.... worked perfectly.  I'll write that down somewhere for\n> the next time I do it :)\n> \n> Is there a better way of handling sub-modules like that? I've looked\n> at git submodules but just got into more of a mess. It would be nice\n> to push a project complete with a (git) submodule upstream but it\n> seems tricky or impossible.\n\nGit submodules are distinct repositories by design, so you'd have to\ncreate an upstream repository for the submodule too to make that work.\nBut I have the impression that you want to import another repository\ninto a directory of your repo, so maybe git subtree is what you want.\n"},{"id":"200294","messageId":"CAHVO_90pLFWb87mFfDpC1ZDQR=jm2YYFj597=kwVPTEv4AA+yg@mail.gmail.com","threadId":"31700","inReplyTo":"5069C760.2020603@web.de","subject":"Re: \"submodule\" mistake and a problem","fromName":"Howard Miller","fromEmail":"howardsmiller@gmail.com","sentAt":"2012-10-01T21:16:18Z","receivedAt":"2012-10-01T21:16:18Z","isPatch":false,"sender":{"key":"howardsmiller@gmail.com","avatar":"https://gravatar.com/avatar/e9a35d459ceb60f2244761bcc3d3bedfda40fa40dadbe8d440c6153d97eef6e2?d=mp&s=160"},"body":"I was not aware of git subtree. I'll go and do some reading. Thanks\nfor the pointer!\n\nOn 1 October 2012 17:40, Jens Lehmann <Jens.Lehmann@web.de> wrote:\n>\n> Am 01.10.2012 14:05, schrieb Howard Miller:\n> >>\n> >> Perhaps:\n> >>\n> >>   git rm -f --cached path/to/subdir   # remove from index, keep files\n> >>   git add path/to/subdir\n> >>\n> >> -- Hannes\n> >\n> > Fantastic.... worked perfectly.  I'll write that down somewhere for\n> > the next time I do it :)\n> >\n> > Is there a better way of handling sub-modules like that? I've looked\n> > at git submodules but just got into more of a mess. It would be nice\n> > to push a project complete with a (git) submodule upstream but it\n> > seems tricky or impossible.\n>\n> Git submodules are distinct repositories by design, so you'd have to\n> create an upstream repository for the submodule too to make that work.\n> But I have the impression that you want to import another repository\n> into a directory of your repo, so maybe git subtree is what you want.\n"}]}