Git – How to remove git subtree merge


I have a project that relies upon another 2 subprojects that have been merged using the subtree merge strategy (as described here and there)?

After a while, I have noticed that one of the subprojects is having his own lifecycle inside the current project, so I'd like to decouple it from the original, but I have no idea how to achieve this.

Basically, I have noticed that the subprojects are listed in the .git/config file so I'm wondering if it is enough to remove it from there.

Following Jakub's answer/question, I'll try to add more details to my question. The project I'm working on ProjectA depends on a library LibraryB which has his own git repository and its own lifecycle.
While setting up ProjectA, I have used the subtree merge technique to add the dependency of LibraryB (the steps are exactly the ones described in the links thankfully added by VonC).
Now, ProjectA needs some custom changes to LibraryB which are not generic enough to be pushed back to LibraryB repository. So, I'd like to decouple the LibraryB in ProjectA from its master repository (by decoupling I mean that LibraryB in ProjectA will not be able to update from its master repository and will have its own history tracked only inside ProjectA).

More details: after checking my ProjectA repository I have figured out that the only reference to LibraryB repository lives in ProjectA/.git/config file in the form:

[remote "gaelib"]
    url = ../libraries/gaelib
    fetch = +refs/heads/*:refs/remotes/gaelib/*

and there is not additional git related information in the directory LibraryB was included in ProjectA (../libraries/gaelib)

Best Solution

It sounds like you want to "undo" a subtree merge and submit it back upstream. The git subtree split command should do this.