GIT Submodule 8/04/2017

Unlike SVN, GIT does not have the concept of external property. The closest it has is something called submodules. And here is the steps I took to create submodules:

*) Clone the repository

*) under local copy, create a folder called "submodules"

*) put any file, such as abc.txt under submodules

*) add abc.txt to the repository, and commit it. GIT does not support empty folders. This file will be used to circumvent this rule before we add links to the real submodules

*) open a cygwin windows, enter the submodules folder we created early

*) type in git submodule add URL, where the URL is the path to the submodule repository

*) Use tortoiseGit to switch the submodule to the tag or branch we want

*) delete abc.txt from the repository

*) commit

To check out, do the following:

*) clone the top repository
  git clone URL_to_top_repository

*) At this point, all submodule links are empty, and they need to be updated:

git submodule update --init --recursive

And after you've been working on the repository, you might need to point your submodules to some new tags. This can be done as following:

git submodule update --remote --recursive

And then go to the specific submodule, use tortoiseGit to switch to the right tag.

To make sure the submodules are pointing to the right snapshot, use

   git submodule status

to display the SHA-1 value of each submodule, and compare them against those SHA-1 values of the expected tags.

    Posted by Changyi at 11:54 PM


Post a Comment

<< Home  





*) Legal Disclaimer
*) The Book


*) PulseRain
*) FPGA Limerick
*) GitHub
*) Forum

*) FCC Wireless
*) PAPA System