diff --git a/documents/git_submodules.md b/documents/git_submodules.md new file mode 100644 index 0000000000000000000000000000000000000000..36f52c2393eb0fd2b8ef634b31329f6dc430425b --- /dev/null +++ b/documents/git_submodules.md @@ -0,0 +1,30 @@ +# Graph Library > Documents > Git Submodules.md + + +## Git Submodules +This project should be used as a "git submodule". Git submodules are essentially projects that are meant to be used +within other projects. + +### Installing Submodules +Submodules can be imported into another project with the command: +* ``git submodule add <project_url> <location_to_store_submodule>``<br><br> +Where: + * `<project_url>` is the same as if you were to run `git clone` to pull the project. + * `<location_to_store_submodule>` is the location you wish the submodule to store within the parent project. + +### Initializing Submodules +When you clone a repo that uses submodules, you'll need to initialize the submodules before they can be accessed. This +can be done in one of two ways: +* Add the `--recursive` tag when you clone the parent project. This will also get all submodules (assuming they're +defined within the master branch).<br><br> +Ex: `git clone --recursive <project_url>`<br> + +* If the original project was already cloned, or if the submodule wasn't in the master branch, use:<br><br> +`git submodule update --init --recursive` + +### Updating Submodules +Any projects that use a submodule will automatically track which commit is being used. When a submodule is updated, the +projects using them will have to update which commit they point to.<br><br> +This is accomplished with 2 steps: +* ``git submodule foreach git pull origin master`` +* Verify the pulled submodule changes are what you want, and commit them. diff --git a/documents/references.md b/documents/references.md index d2df3ab7ac3e71577e0e1af8c14c11004f38b665..15690296b2fe876a3b7e7111507d30f2579a793b 100644 --- a/documents/references.md +++ b/documents/references.md @@ -8,6 +8,12 @@ All references to external logic. Includes anything from stack overflow links to ## New References References new to this project. +### Git Submodules +Since I don't know how Python projects are exported to be a pip library (and I'm not even sure if that's a good use case +for this project), it's being set up as a submodule project for now. +* General Info About Git Submodules: <https://github.blog/2016-02-01-working-with-submodules/> +* Importing a Submodule to a Specific Subdirectory: <https://stackoverflow.com/a/12012292> + ### Drawing Arrows for Directed Graph Connections This ended up being more complicated than I expected. * Main Ref was: <https://stackoverflow.com/a/51370419> diff --git a/readme.md b/readme.md index 7d79430e84a201bb48cd8f7da9f362fa6578be3f..af3109a1331865f8ac1c22e39c2f7498085bae15 100644 --- a/readme.md +++ b/readme.md @@ -2,7 +2,8 @@ ## Description -A custom implementation of a graph data structure. +A custom implementation of a graph data structure. Setup as a library for other projects to import.<br><br> +For information on importing the library as a "git submodule", see `documents/git_submodules.md`. ## Python Environment