Last active
          January 24, 2018 21:04 
        
      - 
      
- 
        Save Nickersoft/4561069aa7217deea37c7473e94e964a to your computer and use it in GitHub Desktop. 
    Proper Way to Remove a Git Submodule
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | # A lot of times people have trouble removing Git submodules, receiving errors about the index still existing in their repo even after | |
| # they deleted the module directory. This is the correct way to do it. | |
| # Add a submodule just so we can remove it | |
| git submodule add https://github.com/Nickersoft/push.js.git ./data/push | |
| # Remove the submodule from the Git cache | |
| git rm --cached ./data/push | |
| # Remove Git module files | |
| rm -rf .git/modules/data/push | |
| # Remove either .gitmodules if it's your only submodule, or remove the block that looks like this from that file: | |
| # [submodule "data/push"] | |
| # path = data/push | |
| # url = https://github.com/Nickersoft/push.js.git | |
| rm -rf .gitmodules | |
| # Finally, you can remove the actual module directory | |
| rm -rf ./data/push | |
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment