1

I`ve forked a repository which contains one submodule, I cloned the repo and its submodule to my laptop and made some changes to the source code and the submodule and pushed them to my repository.

after checking my repository, I noticed that changes I made to the submodule, didn`t pushed.

How can I fix this?

Yashar
  • 2,455
  • 3
  • 25
  • 31

1 Answers1

1

First, forking the repo doesn't fork the submodule: make sure you have the right to push to that submodule repo.
And making changes to a submodule means you need to push to the submodule upstream repo from within said submodule.

cd /path/to/repo/submodule
# changes
git add .
git commit -m "Changes to submodule"
git push

And then you need to add the new gitlink to the index of the parent repo:

cd ..
git add .
git commit -m "Record new submodule state"
git push
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250