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 git submodule add command.
1 2 |
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:
1 2 |
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.
1 |
git clone https://github.com/iosdevzone/IDZAQAudioPlayer |
Change into the working directory.
1 |
cd IDZAQAudioPlayer |
Then initialize and update the submodules.
1 2 |
git submodule init git submodule update |