Skip to content

Instantly share code, notes, and snippets.

@skellertor
Created January 30, 2018 21:20
Show Gist options
  • Save skellertor/5fe561f69879ac3c06c3d7bed926505f to your computer and use it in GitHub Desktop.
Save skellertor/5fe561f69879ac3c06c3d7bed926505f to your computer and use it in GitHub Desktop.
Deleting a git submodule
  1. Delete the relevant section from the .gitmodules file. The section would look similar to:
[submodule "vendor"]
	path = vendor
	url = git://github.com/some-user/some-repo.git
  1. Stage the .gitmodules changes via command line using:
git add .gitmodules
  1. Delete the relevant section from .git/config, which will look like:
[submodule "vendor"]
	url = git://github.com/some-user/some-repo.git
  1. Run git rm --cached path/to/submodule . Don't include a trailing slash -- that will lead to an error.
  2. Run rm -rf .git/modules/submodule_name
  3. Delete the now untracked submodule files rm -rf path/to/submodule
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment