Skip to content

Instantly share code, notes, and snippets.

@allewun
Created February 13, 2014 05:25
Show Gist options
  • Save allewun/8970194 to your computer and use it in GitHub Desktop.
Save allewun/8970194 to your computer and use it in GitHub Desktop.
How to migrate from git submodules to cocoapods

How to migrate from git submodules to cocoapods

  1. Remove git module files used by git

     rm .gitmodules
     rm .git/modules
    
  2. Remove invididual git files/directories used by the submodules

     rm submodule1/{.git/, .gitignore, .gitattributes}
     rm submodule2/{.git/, .gitignore, .gitattributes}
     ...
     rm submoduleN/{.git/, .gitignore, .gitattributes}
    
  3. Remove git's tracking of the submodule directories

     git rm --cached submodule1
     git rm --cached submodule2
     ...
     git rm --cached submoduleN
    
  4. Check that submodules aren't being used anymore

     git submodule
    
  5. git submodules are no longer in use

     git commit -m "Removed submodule usage"
    
  6. Remove the code for the ex-submodules, so that we can reinstall them using cocoapods

  7. Install cocoapods on your machine

     gem install cocoapods
     pod setup
    
  8. Create and update the podfile

    • Go through the 3rd-party projects and see if they are available as pods. If they are, just reference them in the podfile using the versions they specify.

    • If a project wasn't available as a pod, check github or github.com/CocoaPods to see if they've since been added as a pod.

    • Otherwise, if no pod is available, either stick with submodules or just use the project files as regular files in the project.

  9. Install pods (and follow the instructions/warnings)

     pod install
    

Last updated: Nov 5th, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment