0

I have a main app that stored in our git. Within that app we are using a third-party component that's hosted on github. We make numerous customizations to this component, and as such felt that to make updates easier, we should add the component as a submodule.

It was my understanding that by adding this component as a submodule, we would be able to pull upstream changes from github and merge those into our submodule. We would then push those changes to our git.

I successfully added the component as a submodule, and cloned it into my app's directory. I've merged in all our modifications, and committed those locally.

My question is, how do I now add our git as a remote for the submodule so that I can push all my customizations to that server?

1 Answer 1

5

Your submodule is just another git repo. The same steps for adding an additional remote and pushing the changes apply here as well.

cd <DIRECTORY_OF_YOUR_SUBMODULE>
git remote add <REMOTE-NAME> <PRIVATE_GIT_REPO_URL>
git fetch <REMOTE-NAME>

# Now you should be able to merge, rebase or cherrypick or any other
# merge strategy you prefer.

# After merging push the changes into your remote
git push <REMOTE-NAME> <LIST_OF_REFS>
Sign up to request clarification or add additional context in comments.

1 Comment

I assumed as much, but was scared of messing up my repository. Cheers!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.