is added as a subdirectory of another Git repository.! ✤ The contents of the subdirectory are not tracked by the containing repository. ! ✤ It is checked out at a particular commit, not any particular branch.! ✤ The submodule communicates with it’s own upstream repository independently of the containing repository.
to the URL of the submodule and the directory which contains it. Shared with all repositories! ✤ The .git/config file has a reference to the URL of the submodule and directory which contains it. Local to the current repository.! ✤ The .git/modules folder has the actual git repository for the submodule! ✤ The sha of the commit is stored in the repository under the tree of the directory. Just like any other object sha.
Tree - Directories! ✤ Commit - Pointer to a top level directory! ✤ Tag - An object in it’s own right, though usually the lightweight version is used which is like a branch.
model! ✤ Just the contents of the file, not the name, or the mode! ✤ Compressed, and named after it’s SHA-1 hash! ✤ If the contents of several files are the same, the blobs are the same.! ✤ Referred to by the 40 character hash, though 4-7 characters are usually enough! ✤ git cat-file -p <sha> is a handy command
blobs! ✤ Think of it as being like a directory! ✤ The tree is what holds the names and modes of the blobs and trees it contains.! ✤ git ls-tree <sha> is a handy command
upwards! ✤ Renames don’t change the file blob, because contents are the same, but the tree is changed! ✤ Because objects are immutable you never lose history as long as the commit is rooted
path = Externals/AFNetworking! ! url = https://github.com/Abizern/AFNetworking.git [submodule "Externals/AFNetworking"]! ! url = https://github.com/Abizern/AFNetworking.git • The index is updated, but the changes are not checked in.! • You can change the URL of the submodule locally.! • You can change the commit that the submodule points to.
of the submodules, and their description! ✤ If there are unchecked in submodules prepended with a ‘+’! ✤ If the submodule is not initialised prepended with a ‘-’
update! ✤ Check your submodules are up to date with git submodule status! ✤ ALWAYS push changes to your submodule before commiting to the enclosing repository.! ✤ git rm --cached files if you are extracting code to a submodule.! ✤ Use your own clone if you are adding Open Source! ✤ Use http:// URLs instead of git@ or git://
need to add the files to the IDE manually.! ✤ You need to link to system frameworks manually. ! ✤ Not as easy as just dropping the code into the repository or using CocoaPods.
use as a submodule.! ✤ Different branches can have different versions of submodules, or even different submodules.! ✤ Changes can be pushed up from the submodule to a shared repository! ✤ Less of a hurdle for pushing code back to Open Source Projects.