Christie Koehler: Fun with git submodules |
Git submodules are amazingly useful. Because they provide a way for you to connect external, separate git repositories they can be used to organize your vim scripts, your dotfiles, or even a whole mediawiki deployment.
As incredibly useful as git submodules are, they can also be a bit confusing to use. This goal of this article is to walk you through the most common git submodule tasks: adding, removing and updating. We’ll also review briefly how to make changes to code you have checked out as a submodule.
I’ve created some practice repositories. Fork submodule-practice if you’d like to follow along. We’ll used these test repositories as submodules:
I’ve used version 2.3.0 of the git client for these examples. If you’re seeing something different, check your version with git --version
.
First, let’s clone our practice repository:
[skade ;) ~/Work] christie$ git clone git@github.com:christi3k/submodule-practice.git Cloning into 'submodule-practice'... remote: Counting objects: 63, done. remote: Compressing objects: 100% (16/16), done. remote: Total 63 (delta 9), reused 0 (delta 0), pack-reused 47 Receiving objects: 100% (63/63), 6.99 KiB | 0 bytes/s, done. Resolving deltas: 100% (25/25), done. Checking connectivity... done.
And then cd into the working directory:
christie$ cd submodule-practice/
Currently, this project has two submodules: furry-octo-nemesis and psychic-avenger.
When we run ls we see directories for these submodules:
[skade ;) ~/Work/submodule-practice (master)] christie$ ll
Комментировать | « Пред. запись — К дневнику — След. запись » | Страницы: [1] [Новые] |