gitgit-submodulesgit-repo

Create a fat git repository based on git submodules


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!


Solution

  • 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