Skip to content

Instantly share code, notes, and snippets.

@lin
Last active February 19, 2021 04:19
Show Gist options
  • Save lin/8c6c3f0231be36fb1b45e25c9224908f to your computer and use it in GitHub Desktop.
Save lin/8c6c3f0231be36fb1b45e25c9224908f to your computer and use it in GitHub Desktop.
Remove a submodule

Based on https://stackoverflow.com/questions/1260748/how-do-i-remove-a-submodule and https://stackoverflow.com/questions/47008290/git-how-to-make-outer-repository-and-embedded-repository-work-as-common-standal

Note: path/to/submodule (no trailing slash)

  1. git submodule deinit -f -- path/to/submodule
  2. rm -rf .git/modules/path/to/submodule
  3. git rm --cached path/to/submodule
  4. git add path/to/submodule/
  5. git commit -m 'Removed a submodule'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment