git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* How do I delete a git submodule?
@ 2008-11-24 14:44 Peter Krefting
  2008-11-24 15:51 ` Michael J Gruber
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Krefting @ 2008-11-24 14:44 UTC (permalink / raw)
  To: Git Mailing List

Hi!

I am trying to remove a submodule from a project, but can't figure out
how to do it. With "modules/aldc" as a submodule:

  $ cat .gitmodules
  [submodule "modules/aldc"]
          path = modules/aldc
          url = [...cut...]
  [...more entries here...]
  $ git status
  [...cut...]
  nothing to commit (working directory clean)

Starting from a clean set-up.

  $ git submodule rm modules/aldc
  -ff17d9e0e76d01e99d26aa16b28cf327c5abb48a modules/aldc
  $ git status
  [...cut...]
  nothing to commit (working directory clean)

The obvious command didn't give any errors, but didn't do anything,
either. (I notice that there is no mention of a "git submodule rm" on
the git-submodule man page.)

  $ git rm modules/aldc
  rm 'modules/aldc'
  fatal: git rm: modules/aldc: Permission denied
  $ git status
  [...cut...]
  nothing to commit (working directory clean)

Nope, that didn't work either.

What am I missing?

  $ git --version
  git version 1.6.0.2.1172.ga5ed0

(This is Git-1.6.0.2-preview20080923 on Windows XP)

-- 
\\// Peter - http://www.softwolves.pp.se/

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: How do I delete a git submodule?
  2008-11-24 14:44 How do I delete a git submodule? Peter Krefting
@ 2008-11-24 15:51 ` Michael J Gruber
  0 siblings, 0 replies; 2+ messages in thread
From: Michael J Gruber @ 2008-11-24 15:51 UTC (permalink / raw)
  To: Peter Krefting; +Cc: Git Mailing List

Peter Krefting venit, vidit, dixit 24.11.2008 15:44:
> Hi!
> 
> I am trying to remove a submodule from a project, but can't figure out
> how to do it. With "modules/aldc" as a submodule:
> 
>   $ cat .gitmodules
>   [submodule "modules/aldc"]
>           path = modules/aldc
>           url = [...cut...]
>   [...more entries here...]
>   $ git status
>   [...cut...]
>   nothing to commit (working directory clean)
> 
> Starting from a clean set-up.
> 
>   $ git submodule rm modules/aldc
>   -ff17d9e0e76d01e99d26aa16b28cf327c5abb48a modules/aldc
>   $ git status
>   [...cut...]
>   nothing to commit (working directory clean)
> 
> The obvious command didn't give any errors, but didn't do anything,
> either. (I notice that there is no mention of a "git submodule rm" on
> the git-submodule man page.)
> 
>   $ git rm modules/aldc
>   rm 'modules/aldc'
>   fatal: git rm: modules/aldc: Permission denied
>   $ git status
>   [...cut...]
>   nothing to commit (working directory clean)
> 
> Nope, that didn't work either.
> 
> What am I missing?

The last line of git help/man on git submodule status:

"This command is the default command for git-submodule."

git submodule ignores the "rm" (because it doesn't know that command)
and does a "status" on modules/aldc.

OTOH, git rm refuses to do its thing, as you noticed. The brute force
method seems to work:

rm -Rf modules/aldc
#remove module from .gitmodules
#remove module from .git/config
git add -u
git commit -m "get thee hence, modules/aldc"

I edited the two config files manually, but this can be scripted.
git log -p shows a perfect diff including removal of the subproject
commit, so I think the result of the above is fine. I think I'll work on
a patch if nobody stops or beats me...

Cheers,
Michael

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-11-24 15:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-24 14:44 How do I delete a git submodule? Peter Krefting
2008-11-24 15:51 ` Michael J Gruber

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).