0

I'd like to know, if it's possible to do this:

  1. git clone --recursive <repository with submodule>
  2. git remote add fat-repository <path>
  3. ???
  4. git add -A && git commit -m "Test" && git push fat-repository master

Step 3 would de-submodule the repository, keeping the content of the submodule, but removing any trace that it was a submodule.

Thanks!

SwissCodeMen
  • 2,397
  • 3
  • 12
  • 21
thescouser89
  • 111
  • 2

2 Answers2

1

To remove a submodule

# Remove the submodule entry from .git/config
git submodule deinit -f path/to/submodule

# Remove the submodule directory from the superproject's .git/modules directory
rm -rf .git/modules/path/to/submodule

# Remove the entry in .gitmodules and remove the submodule directory located at path/to/submodule
git rm -f path/to/submodule
F.Guerinoni
  • 277
  • 2
  • 11
  • Thanks for the reply! I'd like to keep the git submodule contents, and commit the contents in the parent repository rather than the submodule repository. – thescouser89 Jul 23 '20 at 01:04
  • @thescouser89 You can't because of parent repository track only that submodule changes, not what are the changes... You need to commit changes on submodule and also in the parent (only for committing bump of submodule) – F.Guerinoni Jul 23 '20 at 07:06
  • 1
    Ah thanks! I thought there'd be some procelain commands to create a "fat" repository out of git submodules :) Thank you for your time replying to my question! :) – thescouser89 Jul 23 '20 at 20:33
0

https://www.atlassian.com/git/articles/core-concept-workflows-and-tips

Section: How do I integrate a submodule back into my project?

This contains the correct way to create a fat git repository from submodules:

  1. git rm --cached submodule_path (no trailing slash)
  2. git rm .gitmodules
  3. rm -rf submodule_path/.git
  4. git add submodule_path; git commit -m "remove submodule"

Special thanks to Nick Cross for pointing me to these instructions!

thescouser89
  • 111
  • 2