{"thread":{"id":"28645","subject":"Submodule confusion when checking out branch","startedAt":"2011-10-11T09:38:48Z","lastAt":"2011-10-11T17:35:04Z","messageCount":2,"participants":["Howard Miller","Jens Lehmann"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"177361","messageId":"CAHVO_90rHbqqUx6HCh7tLWO9aP9PyPMpYnZGszCDB2bfNzUXAQ@mail.gmail.com","threadId":"28645","inReplyTo":null,"subject":"Submodule confusion when checking out branch","fromName":"Howard Miller","fromEmail":"howard@e-learndesign.co.uk","sentAt":"2011-10-11T09:38:48Z","receivedAt":"2011-10-11T09:38:48Z","isPatch":false,"sender":{"key":"howard@e-learndesign.co.uk","avatar":"https://gravatar.com/avatar/ddb66c6a4a077e52b823ac5b04f33ab927cb90e2ab1eafedaeba07b1920bb99e?d=mp&s=160"},"body":"I added a submodule to my project like this (all from the root of the project)\n\ngit submodule add git@.....   path/to/submodule\ngit submodule init\ngit add path/to/submodule\ngit commit -m 'I added a submodule!'\ngit push\n\nAll looks good and 'git status' reports 'nothing to commit'\n\nHowever, I now cannot change branches. On checkout, I get...\n\n\"error: The following untracked working tree files would be\noverwritten by checkout:\"\n(followed by a big list of all the files in the submodule)\n\nWhere did I go wrong and what can I do to sort it?\n\nThanks again!\n"},{"id":"177381","messageId":"4E947E48.7080201@web.de","threadId":"28645","inReplyTo":"CAHVO_90rHbqqUx6HCh7tLWO9aP9PyPMpYnZGszCDB2bfNzUXAQ@mail.gmail.com","subject":"Re: Submodule confusion when checking out branch","fromName":"Jens Lehmann","fromEmail":"jens.lehmann@web.de","sentAt":"2011-10-11T17:35:04Z","receivedAt":"2011-10-11T17:35:04Z","isPatch":false,"sender":{"key":"jens.lehmann@web.de","avatar":"https://avatars.githubusercontent.com/u/135220?v=4"},"body":"Am 11.10.2011 11:38, schrieb Howard Miller:\n> I added a submodule to my project like this (all from the root of the project)\n> \n> git submodule add git@.....   path/to/submodule\n> git submodule init\n> git add path/to/submodule\n> git commit -m 'I added a submodule!'\n> git push\n> \n> All looks good and 'git status' reports 'nothing to commit'\n> \n> However, I now cannot change branches. On checkout, I get...\n> \n> \"error: The following untracked working tree files would be\n> overwritten by checkout:\"\n> (followed by a big list of all the files in the submodule)\n> \n> Where did I go wrong and what can I do to sort it?\n\nHmm, as I don't know for what checkout you see this problem (do you\nswitch from a branch containing the submodule to one that doesn't\nhave it or the other way round?) and assuming you had some files\ncommitted in the directory where the submodule lives I can take a\nguess what happened:\n\nCould it be the case that you converted an existing directory into a\nsubmodule and then get this error when you want to switch back to a\nbranch where this directory is still filled with the original files?\n\nThen this is a known shortcoming of submodules at the moment. I have\nexperimental code to make Git work in that case but it is not ready\nfor inclusion yet.\n"}]}