Sunday, December 4, 2022

Completing Removing a Git Submodule

This is a note about removing  a Git submodule completely.

  1. Revise the .gitmodules by removing the reference to the submodule Git repo;
  2. Revise the .git/config file by removing the reference to the submodule Git repo;
  3. Remove the submodule from Git index, e.g.,
        git rm --cached path_to_submodule
    
  4. Delelete the meta data from .git directory, by removing .git/module/path_to_submodule
  5. Stage the changes, and commit the changes, e.g.,
        git add -u
        git commit -m "removed the submodule"
        

Reference

The above is a summary from these references

1 comment: