manage a project and a dynamic framework made from this project with a single git repository

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.

  • Visual Studio 2013 does not offer to do merge on Git pull
  • How to get file's relative path in git aliases with parameters?
  • How to stop git from breaking encoding on checkout
  • What should be included in a windows phone 7 gitignore file?
  • Is it possible to get commit logs/messages of a remote git repo without git clone
  • How can I make git list only the tracked directories in a folder?
  • 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.

  • A multi-developer Git workflow, maintaining a clean history
  • git: what is the correct merging or rebasing workflow to modify a maintenance branch and apply those patches to another branch?
  • change default git hooks
  • Fatal error unpacking a tree object during a git svn fetch
  • Java Client to Connect to Stash Repository
  • Does Git delete empty folders?
  • One Solution collect form web for “manage a project and a dynamic framework made from this project with a single git repository”

    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 git@github.com: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 git@github.com: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

    Git Baby is a git and github fan, let's start git clone.