I've cloned a git submodule of one of my libraries into a project I'm working on. The thing is that, after cloning, I need to change some lines in the cloned submodule, but I don't want to push those changes into the original repository.
I want those changes to stay in the superproject. Is this possible? How can I achieve that?
EDIT: As @GoZoner said, basically its:
Then when I clone the superproject in another computer (up to step 4), I want those changes to be saved, in the superproject.
Pushing updates in the submodule. The submodule is just a separate repository. If you want to make changes to it, you should make the changes in its repository and push them like in a regular Git repository (just execute the git commands in the submodule's directory).
In order to update an existing Git submodule, you need to execute the “git submodule update” with the “–remote” and the “–merge” option. Using the “–remote” command, you will be able to update your existing Git submodules without having to run “git pull” commands in each submodule of your project.
git submodule sync synchronizes all submodules while git submodule sync -- A synchronizes submodule "A" only. If --recursive is specified, this command will recurse into the registered submodules, and sync any nested submodules within.
I think you need to relax the 'no commit to submodule' constraint. There are two options:
Otherwise, I don't see a way to achieve your desire.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With