Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to change few files in submodule without creating fork?

I'm creating cocos2d-x game and include upstream cocos fom git (it include some critical fixes and features). However, using SDKBOX require patching some cocos files (which is in submodule).

Is it possible to include those files (or even better patches to them) to main repository? Of course, it is possible to fork cocos2d-x repository and patch them there, but it makes updates more complicated (create pull request and merge it at first).

like image 744
val is still with Monica Avatar asked Jul 18 '18 15:07

val is still with Monica


1 Answers

Is it possible to change few files in submodule

Yes, but that means the parent repository will reference a new SHA1 representing the root tree of that submodule.
If you push the main repo without pushing the submodule one, anyone cloning the parent repo won't be able to update/checkout the submodule, because of an unknown SHA1.

So you need to be able to push back the fix done in a submodule to its upstream repository.

without creating fork?

If you own the upstream repository, you can push back directly to it.
But if not, a fork, or at least a branch new repository to which you can push back is still needed. Provided you update the submodule URL.

I would say this is still the recommended approach, even though it will involve later on some pull request.

like image 64
VonC Avatar answered Nov 01 '22 01:11

VonC