A Whirlwind Introduction to git submodules

I have put off learning how to use git submodules for too long, but one of my projects has been crying out for them for so long that I finally had to act.

The project IDZAQAudioPlayer demonstrates how to use the IDZPrecompiledOgg and IDZPrecompiledVorbis frameworks to play Ogg Vorbis audio. Before using submodules, the frameworks were manually copied into the IDZAudioPlayer/Frameworks directory and checked into the repository.

Adding Submodules

Adding submodules is relatively simple. Change to the directory where you want the submodules to reside and use {bash}git submodule add{/bash} command.

git submodule add https://github.com/iosdevzone/IDZPrecompiledOgg
git submodule add https://github.com/iosdevzone/IDZPrecompiledVorbis

You can simplify the names of the directories for the submodules. For example:

git submodule add https://github.com/iosdevzone/IDZPrecompiledOgg Ogg
git submodule add https://github.com/iosdevzone/IDZPrecompiledVorbis Vorbis

Cloning a Repository with Submodules

Cloning a repository that uses submodules requires a few extra steps. After cloning the repository.

git clone https://github.com/iosdevzone/IDZAQAudioPlayer

Change into the working directory.

cd IDZAQAudioPlayer

Then initialize and update the submodules.

git submodule init
git submodule update


About idz

A professional software engineer dabbling in iOS app development.
This entry was posted in git and tagged , . Bookmark the permalink.

Leave a Reply