All of lore.kernel.org
 help / color / mirror / Atom feed
* git submodule remove?
@ 2009-07-08 19:41 Tim Henigan
  2009-07-08 21:54 ` Raman Gupta
  2009-07-11  5:27 ` Tim Harper
  0 siblings, 2 replies; 4+ messages in thread
From: Tim Henigan @ 2009-07-08 19:41 UTC (permalink / raw)
  To: git

Hello,

I recently encountered a situation where a user wanted to remove a submodule
from a repository.  Searching the mail archive, I found this thread
[1], but it does
not appear that it was ever followed up.

The Git Submodule Tutorial [2] has instructions for removing submodules, but it
seems natural to teach git how to "submodule rm".

This change would require git-submodule.sh to:
    1. Modify the .gitmodules file (remove the entry for the submodule).
    2. Modify the .git/config file (remove the entry for the submodule).
    3. Delete the newly untracked files.

Another option to consider would be a "submodule rm --cached" option which would
keep the newly untracked files.  However, with this option, I believe
it should still
descend into the submodule directory to remove the leftover submodule
".git" folder.

Is there another way of doing this?  If not, does this sound like a
reasonable change?

Thanks,
Tim Henigan

[1] http://article.gmane.org/gmane.comp.version-control.git/101610/match=submodule+remove
[2] http://git.or.cz/gitwiki/GitSubmoduleTutorial

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

* Re: git submodule remove?
  2009-07-08 19:41 git submodule remove? Tim Henigan
@ 2009-07-08 21:54 ` Raman Gupta
  2009-07-11  5:27 ` Tim Harper
  1 sibling, 0 replies; 4+ messages in thread
From: Raman Gupta @ 2009-07-08 21:54 UTC (permalink / raw)
  To: Tim Henigan; +Cc: git

Tim Henigan wrote:
> The Git Submodule Tutorial [2] has instructions for removing submodules, but it
> seems natural to teach git how to "submodule rm".

I'd like to see this as well.

> This change would require git-submodule.sh to:
>     1. Modify the .gitmodules file (remove the entry for the submodule).
>     2. Modify the .git/config file (remove the entry for the submodule).
>     3. Delete the newly untracked files.

I'm not sure it should be removed from .git/config, and the untracked
files, automatically. If the module is only being removed on one
branch, then switching back to another branch will require the module
to be initialized again. Of course, then the user has to deal with
untracked files and to remember to prune entries from .git/config once
no more branches refer to them.

This is also a problem when renaming modules -- I always end up having
at least two entries in .git/config -- one for the branches using the
old name and one for the branches using the new name.

Perhaps one way to refactor submodule support in .git/config would be
to allow .git/config to specify search/replace expressions (simple or
regex-based) that would apply to the entries in .gitmodules. Most of
the time, a few simple expressions should be sufficient to cover all
of the necessary local settings.

Another possible useful change/addition would be to move the submodule
files in and out of the superproject (perhaps to/from a holding area
in superproject/.git) as the user switches their working copy between
branches that contain or do not contain specific submodules.

Cheers,
Raman Gupta

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

* Re: git submodule remove?
  2009-07-08 19:41 git submodule remove? Tim Henigan
  2009-07-08 21:54 ` Raman Gupta
@ 2009-07-11  5:27 ` Tim Harper
  1 sibling, 0 replies; 4+ messages in thread
From: Tim Harper @ 2009-07-11  5:27 UTC (permalink / raw)
  To: Tim Henigan; +Cc: git

On Wed, Jul 8, 2009 at 1:41 PM, Tim Henigan<tim.henigan@gmail.com> wrote:
> Hello,
>
> I recently encountered a situation where a user wanted to remove a submodule
> from a repository.  Searching the mail archive, I found this thread
> [1], but it does
> not appear that it was ever followed up.
>
> The Git Submodule Tutorial [2] has instructions for removing submodules, but it
> seems natural to teach git how to "submodule rm".
>
> This change would require git-submodule.sh to:
>    1. Modify the .gitmodules file (remove the entry for the submodule).
>    2. Modify the .git/config file (remove the entry for the submodule).
>    3. Delete the newly untracked files.
>

Submodules are tracked by the tree.  You'll need to 'rm -rf' the
submodule, and then 'git rm' the folder to remove it.

> Another option to consider would be a "submodule rm --cached" option which would
> keep the newly untracked files.  However, with this option, I believe
> it should still
> descend into the submodule directory to remove the leftover submodule
> ".git" folder.
>
> Is there another way of doing this?  If not, does this sound like a
> reasonable change?

I can think of the only opposition being how blatantly dangerous it
would be. You're creating a command that will nuke the whole
repository, along with any unpushed changes.  There's potential there
for someone to seriously injure themselves without realizing it.

There's also the issue of once you delete a submodule... now what?
Git won't automatically remove them from other repositories when the
change gets pulled.  The folder will show up as untracked.  So far the
current paradigm with git submodules is git is very "hands off" and
leaves as much as possible to you. I think we would have to see a
change in thought consistently around how to approach submodules
before git implements anything of this sort.

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

* git submodule remove?
@ 2008-03-31 18:58 Asheesh Laroia
  0 siblings, 0 replies; 4+ messages in thread
From: Asheesh Laroia @ 2008-03-31 18:58 UTC (permalink / raw)
  To: git

I notice that in git-submodule, there is an "add", a "status", an 
"init", and an "update" command, but no "remove" command.

I have "git version 1.5.4.4", and man git-submodule provides no mention of 
the right way to remove a submodule.  I imagine that removing it from 
.gitmodules and rm -rf'ing the tree that git-submodule cloned should do 
the trick. Is this documented somewhere?

-- Asheesh.

-- 
Editing is a rewording activity.

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

end of thread, other threads:[~2009-07-11  5:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-08 19:41 git submodule remove? Tim Henigan
2009-07-08 21:54 ` Raman Gupta
2009-07-11  5:27 ` Tim Harper
  -- strict thread matches above, loose matches on Subject: below --
2008-03-31 18:58 Asheesh Laroia

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.