Re: [RFC] Submodules in GIT
From: Linus Torvalds <torvalds@osdl.org>
Date: 2016-08-11 20:39:49
On Sat, 25 Nov 2006, Steven Grimm wrote:
Linus Torvalds wrote:quoted
So I actually think that submodules should at least start out as something rather independent, where a "commit -a" in the supermodule will _only_ commit the supermodule itself - and if you haven't committed the submodule yet, you'll just get the current HEAD state of the submodule.That would make it impossible to atomically commit a change that affects two submodules, yes?
No. Quite the reverse. What you do is: (a) commit both submodules INDEPENDENTLY. (b) then commit the supermodule that contains the submodules. And note how the important part here is that committing in a submodule DOES NOT AFFECT THE SUPERMODULE AT ALL! The git trees are _independent_. That's important. You should _not_ try to mix them up and make a commit in one commit anything AT ALL in some other tree, exctly because it gets impossible to do (a) interesting things and (b) atomic commits otherwise. Note that this is true also in the case of a submodule that itself contains a submodule. That doesn't change anything - you still need to be able to view _each_ layer as an independent thing.