How do I remove a submodule from a project?

To remove a submodule you need to:

  1. Delete the relevant line from the . gitmodules file.
  2. Delete the relevant section from . git/config .
  3. Run git rm –cached path_to_submodule (no trailing slash).
  4. Commit and delete the now untracked submodule files. Stack Overflow reference.

How do you pull down a submodule?

Pulling with submodules. Once you have set up the submodules you can update the repository with fetch/pull like you would normally do. To pull everything including the submodules, use the –recurse-submodules and the –remote parameter in the git pull command .

How do you manage submodules?

Make changes inside a submodule

  1. cd inside the submodule directory.
  2. Make the desired changes.
  3. git commit the new changes.
  4. git push the new commit.
  5. cd back to the main repository.
  6. In git status you’ll see that the submodule directory is modified.
  7. In git diff you’ll see the old and new commit pointers.

How do I change individual submodule?

In order to update an existing Git submodule, you need to execute the “git submodule update” with the “–remote” and the “–merge” option. Using the “–remote” command, you will be able to update your existing Git submodules without having to run “git pull” commands in each submodule of your project.

How do I delete a submodule in SourceTree?

Deleting a Submodule from SourceTree removes the line in .


  1. Remove the data in . git/config.
  2. Remove the cached path in the index (git rm –cached submodule_path)
  3. Remove the cached data in . git/modules.

Should submodules be in Gitignore?

No, you don’t need to add your submodule to your . gitignore : what the parent will see from your submodule is a gitlink (a special entry, mode 160000 ). That means: any change directly made in a submodule needs to be followed by a commit in the parent directory.

Are git submodules a good idea?

Git submodules may look powerful or cool upfront, but for all the reasons above it is a bad idea to share code using submodules, especially when the code changes frequently. It will be much worse when you have more and more developers working on the same repos.

How do I change my submodule to master?

Steps to update git submodules

  1. Clone the remote repository, if you haven’t already.
  2. Issue a git submodule update –remote command.
  3. Add any new files pulled from the repository to the Git index.
  4. Perform a git commit.
  5. Push back to origin.

What is the point of git submodules?

Git submodules allow you to keep a git repository as a subdirectory of another git repository. Git submodules are simply a reference to another repository at a particular snapshot in time. Git submodules enable a Git repository to incorporate and track version history of external code.