Bob Rockefeller
Bob Rockefeller

Reputation: 4606

How do I get git submodule changes from parent to child repository?

I have a project repo (the parent) that contains a submodule (the child).

While working in the parent, I have made changes to the files of the child. I've committed those changes in the parent.

How do I get those changes back over to the child?

Upvotes: 1

Views: 1679

Answers (1)

VonC
VonC

Reputation: 1330082

You need to add a commit your changes in the child submodule folder, where you can also git push back to its own upstream repo.

Then you go back to the parent, add and commit the new gitlink (special entry in the index, referencing the new SHA1 of the submodule), and push.

After discussion, the OP mentions:

/Users/bob/Documents/Web Development/Projects/materialize is a public available theme for the Grav open source CMS.
/Users/bob/Sites/www.materialize.dev is the development version of a private website that uses the theme.

I can't add, commit, and push from the child because edits made in the parent's folder structure do not show as changes in the child, and so there's nothing to commit.
My objective is to develop the website (parent) as a way to develop the theme (child). So I edit in the parent. The theme is published as a complete package on GitHub, the website is not. Am I going about this all in the wrong way from the start?

I do mention that a submodule should be able to ignore what the parent repo is doing (it is simply referenced by said parent repo at a fixed commit).
So the current structure might not be a good fit for the type of development the OP is after.

Upvotes: 1

Related Questions