
- #REMOVING GIT SUBMODULE HOW TO#
- #REMOVING GIT SUBMODULE UPDATE#
- #REMOVING GIT SUBMODULE PRO#
- #REMOVING GIT SUBMODULE CODE#
git metadata folder ( make sure you have backup of this): rm -rf submodule_path/.gitĪdd the submodule to the main repository index: git add submodule_path git commit -m "remove submodule" gitmodules file or if you have more than one submodules edit this file removing the submodule from the list: git rm.
#REMOVING GIT SUBMODULE CODE#
Or, in other words, how do I un-submodule a git submodule? If all you want is to put your submodule code into the main repository, you just need to remove the submodule and re-add the files into the main repo:ĭelete the reference to the submodule from the index, but keep the files: git rm -cached submodule_path (no trailing slash)ĭelete the. How do I integrate a submodule back into my project?
#REMOVING GIT SUBMODULE HOW TO#
So, here is what I have for you: How to swap a git submodule with your own fork Let me save you research time: Instapaper, Evernote or old school bookmark this page (:D:D) and you will be set for a while. When that happens you will have to look the solution up. If you use git submodules in your project you either have run into these or you will. There are however simple operations that do not have a streamlined procedure or strong command line user interface support.

The submodule infrastructure is powerful and allows for useful separation and integration of codebases. Again this works when updates are not too frequent.Ĭredit to finch for the well-explained scenarios. When you are delegating a piece of the project to a third party and you want to integrate their work at a specific time or release. I do this for my vim plugins for example. When you have a component that isn't updated very often and you want to track it as a vendor dependency. When a component or subproject is changing too fast or upcoming changes will break the API, you can lock the code to a specific commit for your own safety. There are at least three scenarios where submodules are a fair choice: Possible Workflowsīy remembering this core concept and reflecting on it, you can understand that submodule support some workflows well and less optimally others.
#REMOVING GIT SUBMODULE UPDATE#
Until you update the parent project, nothing changes. You have one remote repository, and you point to a single commit.

If you have a bunch of forks of a module, git submodules don't care. If you add commits to a submodule, the parent project won't know. You are tracking specific commits with git submodules - not branches, not references, a single commit. When you make changes and commit in that subdirectory, the superproject notices that the HEAD there has changed and records the exact commit you’re currently working off of that way, when others clone this project, they can re-create the environment exactly.
#REMOVING GIT SUBMODULE PRO#
As very clearly expressed in the Pro Git chapter mentioned earlier: They are never automatically updated when the repository specified by the submodule is updated, only when the parent project itself is updated. Submodules are tracked by the exact commit specified in the parent project, not a branch, a ref, or any other symbolic reference.

How to swap a git submodule with your own fork.What I'll do here is share some interesting things that will help you make the most of this feature. There is already good and detailed information about submodules out and about so I won't rehash things. As usual with everything git, the approach is opinionated and encourages a bit of study before it can be used proficiently.

It's a convenient way to solve the vendor library and dependency problems. Including submodules as part of your Git development allows you to include other projects in your codebase, keeping their history separate but synchronized with yours.
