I have decided to switch from SVN to git for my app repository.
My repo structure is like this:
~/AndroidStudioProjects/MyMine $ tree -L 1 . ├── ActionBarSherlock ├── Android-Universal-Image-Loader ├── Android-ViewPagerIndicator ├── Crouton ├── ListViewAnimations ├── MyMine ├── SlidingMenu ├── aFileChooser ├── drag-sort-listview └── out 10 directories, 0 files As you can see, I have plenty of libraries, and the core of my app is in the MyMine folder.
I have added the libraries as git submodules:
~/AndroidStudioProjects/MyMine $ cat .gitmodules [submodule "ActionBarSherlock"] path = ActionBarSherlock url = https://github.com/JakeWharton/ActionBarSherlock.git [submodule "Android-Universal-Image-Loader"] path = Android-Universal-Image-Loader url = https://github.com/nostra13/Android-Universal-Image-Loader.git [submodule "Android-ViewPagerIndicator"] path = Android-ViewPagerIndicator url = https://github.com/JakeWharton/Android-ViewPagerIndicator.git [submodule "Crouton"] path = Crouton url = https://github.com/keyboardsurfer/Crouton.git [submodule "drag-sort-listview"] path = drag-sort-listview url = https://github.com/bauerca/drag-sort-listview.git [submodule "ListViewAnimations"] path = ListViewAnimations url = https://github.com/nhaarman/ListViewAnimations.git [submodule "SlidingMenu"] path = SlidingMenu url = https://github.com/jfeinstein10/SlidingMenu.git [submodule "aFileChooser"] path = aFileChooser url = https://github.com/iPaulPro/aFileChooser.git Now, let's say I make changes to one of the libraries/submodules. But I don't want to push those changes to their origin, because:
- the author may/will decline my commits
- my changes are only relevant to me
- my changes are only one-line modifications that adapt the code so that it compiles inside my project
However, what I do want is to push my commits (made to those submodules) to my project's origin. This is because those changes are necessary for compiling my project. So I want them to be in the repo if I decide for example to clone the full repo to a new development machine. Or if a new guy comes to the team and needs to setup its development machine.
So, then, I have committed the modifications made to one of the libraries. Then, I committed the corresponding submodule to my repository, and pushed it to the origin.
The problem is that on the origin (of my server), the submodule projects points to a wrong snapshot, because that snapshot is only existing on my local repo, and not on origin's. And I can't push that, because git would try to push the commits to the submodule's origin, which is not my project's origin.
How can I commit changes made to a submodule, and have those changes available from my main repository? All of that without pushing the submodule to its origin?
I apologize if the terminology or the methods I use seem dumb or aren't appropriate. As I said, I'm trying to switch to git, and even if I spent some time reading a git book, I may have misunderstood some of the processes or vocabulary.