0

I have a submodule-heavy git structure at my job, and even though I am managing to work with it, it isn't all easy. Well, submodules are evil, after all. But that's what I have to work with, and I'm looking for an easier/righter way.

Imagine a working set with a following structure:

root_folder, non-git
├ Project1
| ├ submoduleA
| ├ submoduleB
| └ src
├ Project2
| ├ submoduleA
| └ src
└ Project3
  ├ submoduleA
  └ src

I want to make a change in Project1/submoduleA, so that it will be visible in Project2/submoduleA and Project3/submoduleA with the least number of steps.

So far, my itinerary is

  1. Make sure all submodules have the same revision and branch I'm working on.
  2. Commit my changes in Project1/submoduleA.
  3. Push them to remote
  4. Pull changes from remote Project2/submoduleA and Project3/submoduleA. The more projects are affected by it, the more bothersome it becomes.

I'd like to find a way that excludes step 2 (pushing to remote).

First, I prefer not to publish unfinished commits, as may need to amend them if I make typo or simply drafting out the submoduleA changes. Second, I may accidentally commit something wrong to remote. Third, dependency on remote may inhibit me from working if there's something with the Internet connection.

I'd like to use symlinks, if it were any unix OS, but I'm on Windows, and I'm not sure if that's a good idea to mix git with symlinks.

I tried googling the solution, but the answer eludes me. This was the closest one, I think. But it didn't give me an answer. And this has a lot of related knowledge, but I don't think it has the bit that I need.

So, does anybody know how to sync git submodules locally, without intermediate push to remote or excessive filesystem juggling?

Xobotun
  • 1,121
  • 1
  • 18
  • 29

0 Answers0