{"thread":{"id":"16442","subject":"How do I delete a git submodule?","startedAt":"2008-11-24T14:44:17Z","lastAt":"2008-11-24T15:51:16Z","messageCount":2,"participants":["Peter Krefting","Michael J Gruber"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"96417","messageId":"Pine.LNX.4.64.0811241537580.22925@ds9.cixit.se","threadId":"16442","inReplyTo":null,"subject":"How do I delete a git submodule?","fromName":"Peter Krefting","fromEmail":"peter@softwolves.pp.se","sentAt":"2008-11-24T14:44:17Z","receivedAt":"2008-11-24T14:44:17Z","isPatch":false,"sender":{"key":"peter@softwolves.pp.se","avatar":"https://avatars.githubusercontent.com/u/990764?v=4"},"body":"Hi!\n\nI am trying to remove a submodule from a project, but can't figure out\nhow to do it. With \"modules/aldc\" as a submodule:\n\n  $ cat .gitmodules\n  [submodule \"modules/aldc\"]\n          path = modules/aldc\n          url = [...cut...]\n  [...more entries here...]\n  $ git status\n  [...cut...]\n  nothing to commit (working directory clean)\n\nStarting from a clean set-up.\n\n  $ git submodule rm modules/aldc\n  -ff17d9e0e76d01e99d26aa16b28cf327c5abb48a modules/aldc\n  $ git status\n  [...cut...]\n  nothing to commit (working directory clean)\n\nThe obvious command didn't give any errors, but didn't do anything,\neither. (I notice that there is no mention of a \"git submodule rm\" on\nthe git-submodule man page.)\n\n  $ git rm modules/aldc\n  rm 'modules/aldc'\n  fatal: git rm: modules/aldc: Permission denied\n  $ git status\n  [...cut...]\n  nothing to commit (working directory clean)\n\nNope, that didn't work either.\n\nWhat am I missing?\n\n  $ git --version\n  git version 1.6.0.2.1172.ga5ed0\n\n(This is Git-1.6.0.2-preview20080923 on Windows XP)\n\n-- \n\\\\// Peter - http://www.softwolves.pp.se/\n"},{"id":"96421","messageId":"492ACD74.30108@drmicha.warpmail.net","threadId":"16442","inReplyTo":"Pine.LNX.4.64.0811241537580.22925@ds9.cixit.se","subject":"Re: How do I delete a git submodule?","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2008-11-24T15:51:16Z","receivedAt":"2008-11-24T15:51:16Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Peter Krefting venit, vidit, dixit 24.11.2008 15:44:\n> Hi!\n> \n> I am trying to remove a submodule from a project, but can't figure out\n> how to do it. With \"modules/aldc\" as a submodule:\n> \n>   $ cat .gitmodules\n>   [submodule \"modules/aldc\"]\n>           path = modules/aldc\n>           url = [...cut...]\n>   [...more entries here...]\n>   $ git status\n>   [...cut...]\n>   nothing to commit (working directory clean)\n> \n> Starting from a clean set-up.\n> \n>   $ git submodule rm modules/aldc\n>   -ff17d9e0e76d01e99d26aa16b28cf327c5abb48a modules/aldc\n>   $ git status\n>   [...cut...]\n>   nothing to commit (working directory clean)\n> \n> The obvious command didn't give any errors, but didn't do anything,\n> either. (I notice that there is no mention of a \"git submodule rm\" on\n> the git-submodule man page.)\n> \n>   $ git rm modules/aldc\n>   rm 'modules/aldc'\n>   fatal: git rm: modules/aldc: Permission denied\n>   $ git status\n>   [...cut...]\n>   nothing to commit (working directory clean)\n> \n> Nope, that didn't work either.\n> \n> What am I missing?\n\nThe last line of git help/man on git submodule status:\n\n\"This command is the default command for git-submodule.\"\n\ngit submodule ignores the \"rm\" (because it doesn't know that command)\nand does a \"status\" on modules/aldc.\n\nOTOH, git rm refuses to do its thing, as you noticed. The brute force\nmethod seems to work:\n\nrm -Rf modules/aldc\n#remove module from .gitmodules\n#remove module from .git/config\ngit add -u\ngit commit -m \"get thee hence, modules/aldc\"\n\nI edited the two config files manually, but this can be scripted.\ngit log -p shows a perfect diff including removal of the subproject\ncommit, so I think the result of the above is fine. I think I'll work on\na patch if nobody stops or beats me...\n\nCheers,\nMichael\n"}]}