Tuesday, January 17, 2012

Remove a git submodule

  1. Delete the relevant line from the .gitmodules file.
  2. Delete the relevant section from .git/config.
  3. Run git rm --cached path_to_submodule (no trailing slash).
  4. Commit and delete the now untracked submodule files.

Wednesday, January 11, 2012

Update Git Submodules

// Check submodules
git submodule

For example, I want to update my RestKit submodule at the (project root)/RestKit/ folder, I do the following steps:

// Update RestKit
cd RestKit/
git fetch
git merge origin/master

// Commit/Push changes
cd ..
git add RestKit
git commit -m "..."
git push