Reputation: 2822
I have an ios standalone project managed with git in a git repository.
With this code, I am creating an ios dynamic library which will have some slight modifications from the standalone code to make it work as a library.
Now I have to manage two different code bases and whenever I make a change in the standalone project, sometimes I miss the changes in the dynamic library.
Is it possible to manage the common code in the standalone project and dynamic library from a common repository or what is the right way to do this?
I need to maintain standalone project separately because I cannot run and debug the framework easily as the standalone project.
Upvotes: 3
Views: 88
Reputation: 1329292
If the standalone project can live in a subfolder of the dynamic library project, then you can use git submodule to reference a SHA1 of the first project into the second one.
git submodule add [email protected]:AFNetworking/AFNetworking.git Vendor/AFNetworking
Each time you modify anything in that subfolder, you can commit and push as usual, but also go back to your main project (the dynamic one), add, commit and push to record the new SHA1 of your submodule.
The other approach would be to use a subtree (as illustrated here, see tutorial).
git subtree add --prefix=Vendor/AFNetworking --squash [email protected]:AFNetworking/AFNetworking.git master
I prefer the first approach, but you can see both used in the context of a IOS project in this article
Upvotes: 5