Skip to content

Instantly share code, notes, and snippets.

@vladskiy
Last active October 4, 2016 15:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vladskiy/6196dcff215d5aa132cb1edfd8340c54 to your computer and use it in GitHub Desktop.
Save vladskiy/6196dcff215d5aa132cb1edfd8340c54 to your computer and use it in GitHub Desktop.
Remove 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
2. Stage the .gitmodules changes via command line using:git add .gitmodules
3. Delete the relevant section from .git/config, which will look like:
[submodule "vendor"]
url = git://github.com/some-user/some-repo.git
4. Run git rm --cached path/to/submodule . Don't include a trailing slash -- that will lead to an error.
5. Run rm -rf .git/modules/submodule_name
6. Commit the change:
7. Delete the now untracked submodule files rm -rf path/to/submodule
Credits: https://davidwalsh.name/git-remove-submodule
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment