-
Notifications
You must be signed in to change notification settings - Fork 0
Adding the SAAS libraries to your repository
This page will show you how to add the libraries repository into your repository.
SAAS recommends that you use Git submodules to embed our libraries into your repository. Simply copying and pasting is not the ideal situation and is not recommended.
Git submodules are essentially a way to embed a Git repository within a Git repository. Submodules are made up of two things: a remote URL, and a SHA1 commit id. When you clone a repository and initialize the submodules, Git will clone the URL into the specified path, then cd
into the new directory and check out the specified commit. For example, you might have a submodule that has a path of "Libraries", a remote URL of git://github.com/saasrobotics/Libraries.git
, and a commit id of a55236c4af35ea0383b721cde3e255d766b34698
. For a setup like this, Git will initialize the submodule by doing the equivalent of the following:
git clone git://github.com/saasrobotics/Libraries.git Libraries
cd Libraries
git checkout a55236c4af35ea0383b721cde3e255d766b34698
For more information about submodules, consult the git-submodule(1) manpage, along with the Pro Git section on submodules.
Importing the libraries is fairly easy. You will need to use the Git shell for the initial import, but after that, you should be able to use the GitHub app.
- Open the GitHub app and find the repository that you want to import into. For SAAS team members, this is probably your team number under the saasrobotics organization on GitHub.
- In the upper-right, click the gear icon, then click "Open in Git Shell"1.
- Execute the following command:
git submodule add git://github.com/saasrobotics/Libraries.git $target
2, replacing$target
with whatever directory name you want the libraries to be cloned into. A good choice for this might belibraries
orLibraries
. (To execute a command, type it into the prompt and press enter.) - (Optional) Choose a specific revision of the libraries that you wish to use by executing
cd $target
, followed bygit checkout $commit
, replacing$commit
with the desired revision. Then typecd ..
to return to the main repository. - Commit your results. You may do this from either the shell or from GitHub for Windows, but you must make sure to commit both the
.gitmodules
file and whatever$target
is. If you do not commit both of these files, your submodule will not work on other computers.
- Updating your submodule
- Ensuring that your submodule is properly downloaded (troubleshooting) (TODO)
1: These instructions were designed for GitHub for Windows 2.x. The interface may be different in future GitHub for Windows versions, or in GitHub for Windows 1.x. Using GitHub for Windows is not required if you prefer to use Git differently; all you need is a shell that can use the git
command.
2: If for some reason you would like a read-write submodule instead of a readonly submodule, use git submodule add git@github.com:saasrobotics/Libraries.git $target
(if your team tends to open the Git Shell from GitHub for Windows) or git submodule add https://github.com/saasrobotics/Libraries.git
(if your team tends to open the Git Shell from something other than GitHub for Windows). If in doubt, choose the first one.
SAAS Robotics wiki by SAAS Robotics members is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.