Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add beginner guide to Git submodules #1

Open
Smartyguy001 opened this issue Sep 9, 2024 · 0 comments
Open

Add beginner guide to Git submodules #1

Smartyguy001 opened this issue Sep 9, 2024 · 0 comments

Comments

@Smartyguy001
Copy link

Such a guide can be helpful to beginners and can make contributing seem friendlier and easier.
I will now write a draft of such a guide, should it be useful to anyone fixing this issue.


HOW TO work with a SUBMODULE project, on a simple level, with GITHUB DESKTOP (GHD)

1. CLONING

The only command for which you actually need a CLI
The command is:

git clone --recurse-submodules

Then you can use "Add existing repository" in GHD

2. FETCHING + PULLING

Automatically done with --recurse-submodules
No extra work required; just go in the main repository in GHD and fetch/pull

3. ACCESSING A SUBMODULE

After you cloned / pulled the main repo (recursively), you can go in GHD to "Add existing repository" and find the submodule folder, located inside the main repo's folder. That folder is the submodule repo, add it. Then, you can work inside it as normally

4a. PUSHING SUBMODULE CHANGES

While you are in the submodule repo in GHD (not the main repo), push the changes. Remotely, the submodule will be updated. Locally, the main repo will be now pointing to the new submodule.

Ah, but the remote main repo doesn't point to the updated submodule! Help!

For this, we have point 4b:

4b. PUSHING MAIN REPO CHANGES (and submodule pointers)

Go in the main repo in GHD and... push! Yeah, that's it!

TL;DR

Wanna clone everything? CLI: git clone --recurse-submodules
Wanna fetch/pull everything? Fetch/pull from the main repo
Wanna push everything? Push everything in the submodule(s) you worked on, then in the parent repo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant