From ed8956b22899bfc03a6661c890dcf3ecbea6e01a Mon Sep 17 00:00:00 2001 From: Rachel Chiong Date: Thu, 18 Apr 2024 17:51:38 +1000 Subject: [PATCH] Add blog post about submodules --- .gitmodules | 0 _posts/2024-04-18-submodules.md | 37 +++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 .gitmodules create mode 100644 _posts/2024-04-18-submodules.md diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..e69de29 diff --git a/_posts/2024-04-18-submodules.md b/_posts/2024-04-18-submodules.md new file mode 100644 index 0000000..c622e0c --- /dev/null +++ b/_posts/2024-04-18-submodules.md @@ -0,0 +1,37 @@ +# Setting up submodules in your repo +Sometimes, when working cross-project or with code that's been cloned from +elsewhere, it helps to add them as a submodule to a main repo. + +For example, for assignment 2 I need to write a blog (this one!), +generate a fingerprint identifier GUI and train image classification models +on a CPU and GPU, all of which are in different repos upon set up. + +Without submoduling, each time I log in to a remote desktop session to +remote lab computers, I'd need to clone each of these repos individually +which is a lot more effort than it's worth. + +## Steps to add a submodule repo +### 1. Clone your main repo +```sh +git clone +``` + +### 2. Clone in your sub-module repo/s +Just clone in your submodules like normal here. The magic is in the next step. + +```sh +cd +git clone +``` + +### 3. Add your repo to git +```git +git submodule add +``` +If successful, you should get a message saying that it has been successfully added. + +And voila! You should be able to verify that a submodule has been added on github. + + +## Steps to clone your repo with submodules +Now, when