I have a project that has a number of submodules and I am trying to make them act as normal folder and not repos. I have deleted the .git/
folder in each of them,but they still act like submodules and when I run a git status
they do not seem to show up as untracked files.
Asked
Active
Viewed 5,779 times
5

Trt Trt
- 5,330
- 13
- 53
- 86
-
1Why are you doing that? – jonrsharpe Oct 13 '16 at 18:37
-
because I need a 'snapshot of the project' – Trt Trt Oct 13 '16 at 18:54
-
Why is that in quotes? What do you actually *mean*? What are you doing with the snapshot? – jonrsharpe Oct 13 '16 at 18:55
-
1it doesn't matter what I am doing. When I push the container application, I want the submodules to be pushes as directories. Now they are pushed as git submodules – Trt Trt Oct 13 '16 at 18:56
-
1Yes it does matter, because there could be a completely different way to achieve whatever it is you're doing and solving the [XY problem](http://meta.stackexchange.com/q/66377/248731) could make everyone's life easier. Pushing to what? Why does whatever it is care whether they're submodules or not? – jonrsharpe Oct 13 '16 at 18:57
-
I want to push the container app, with the submodules as simple folders, and not references to other git repos, as they are being pushed now. – Trt Trt Oct 13 '16 at 19:00
-
Possible duplicate of [How do I remove a submodule?](http://stackoverflow.com/questions/1260748/how-do-i-remove-a-submodule) – 1615903 Oct 14 '16 at 04:23
-
But if you really just want a snapshot, you could use `git archive` as described in this question: http://stackoverflow.com/q/615816/1615903 – 1615903 Oct 14 '16 at 04:27
1 Answers
4
The submodule needs to be removed using git rm
(this'll remove the submodule's files from your file system). You can then clone the submodule's repository into your repo (using git clone
), remove the .git directory in the "submodule"'s directory, and git add
!

lungj
- 721
- 5
- 16
-
There is a number of submodules that I use. Usually I clone the parent project, then I run a 'git submodule --init' so I get the submodules files. It also sets each submodule's HEAD in to a specific commit. So doing it your way, cloning each submodule seperately might not point them to the right commit – Trt Trt Oct 13 '16 at 18:59
-
You can do a checkout of the correct version inside the directory before removing `.git`. – lungj Oct 13 '16 at 19:20
-
that is the problem if I do remove the .git folder it still doesn't show the submodule folder as an untracked file – Trt Trt Oct 14 '16 at 11:17
-
1