简体   繁体   中英

git - messed up with submodule

I have 2 individual git repositories, for instance, like this:

1) MyApplication (V1)

2) MyLibrary (V1)

I added 'MyLibrary' as a submodule to 'MyApplication', then made some changes to 'MyLibrary' at the submodule's source files, and then I committed and pushed the changes.

What happen now is that the latest change of 'MyLibrary' is a commit of 'MyApplication', its no longer going back to the orginial 'MyLibrary'

So my current repositories look like this:

1) MyApplication (V1)

1.1) --> Submodule MyLibrary (V2)

2) MyLibrary (V1)

With Subversion, when you commit any externals, the change always go back to the original repository

The concept of submodule in git really confused me a lot!

Look at submodules in Git as separate repositories. What you need to do is treat them like separate repositories meaning if you make a change on the submodule (in this case MyLibrary) you would also need to commit and push that submodule to remote separately.

They are pretty much independent from each other when it comes to changes within the submodule. "MyLibrary" only says: "Hey, I have dependencies on this submodule, also keep that one updated when fetching".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM