Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tracking changes in submodules

Tags:

git

Is there any way to store changes made to submodules in the parent repository? I'm using a library which I have modified very slightly (just a couple lines of code modified). I'd rather not check the entire library into my repository if there's an alternative.

like image 942
foldl Avatar asked Feb 04 '26 22:02

foldl


1 Answers

Changes to submodules can be checked in locally within the submodule's repository. They're not required to be pushed back to the original location of the submodule. However, if you are sharing your parent project externally to your team, you'll need to make the submodule changes publicly visible.

Example:

  • local repository "foo"
  • submodule within foo called "bar"
  • make changes within bar, ideally within a new branch
  • commit those changes locally within bar
  • commit foo locally

So long as you're not sharing this repository externally, this is fine. Otherwise, you'll have to push the changes to the submodule, so that other team members can see your changes to the submodule.

like image 184
Jess Bowers Avatar answered Feb 07 '26 16:02

Jess Bowers



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!