Mastering Git submodules
medium.com
medium.com
On the other hand, if the technological context allows for packaging and formal dependency management, you should absolutely go this route instead: it lets you better split your codebase, avoid a number of side effects and pitfalls that litter the submodule space, and let you benefit from versioning schemes such as semantic versioning (semver) for your dependencies.
Yeah, but that's the manual way. It works okay when you're only developing a small number of modules (say 1 to maybe 3), but at some point doing it manually becomes pretty annoying. And you need scripts and commits to package.json files if you have a build server which makes builds of feature branches.
I've had detached head issues, but nothing that didn't take a minute or two to solve.
It might be that I'm using SourceTree exclusively, so maybe SourceTree is hiding away the painful bits or something.
Or, maybe your use case skirts around the problems?
If you don't roll forward and back in time (bisect), and you don't have merge conflicts, and you can easily resolve abandoned commits on submodules (i.e. you don't have to wait for Bangalore to wake up and push their changes) then, yes, you probably won't have many issues.
[1] https://github.com/ingydotnet/git-subrepo/blob/master/Intro....
But on the whole, it is often less painful than submodules. I haven't tried subtree yet, will do that next :-)
This was fixed recently. [1]
> I haven't tried subtree yet, will do that next :-)
The git-subrepo intro has a pretty good overview of the issues with git-subtree. [2]
[1] https://github.com/ingydotnet/git-subrepo/issues/40
[2] https://github.com/ingydotnet/git-subrepo/blob/master/Intro....
Four lines of the commit message are about git-subrepo, which I don't care about. I'm not a git-subrepo developer, and don't care what version of the tool was used to generate the commit.
What I do care a lot about is why a commit was made, and those auto-generated commit messages don't tell me that at all. They can't, because the tools don't read minds. That's why git usually prompts me for a commit message. I like that. It's one of the reasons I'm using version control. It would be nice if git-subrepo played along.
git commit --amend
I personally find it a useful default, though, i.e. there's not usually much more I want to say than "added a subrepo: [metadata...]", and, for something like this, I'd rather err on the side of too much information than too little.[1]: http://blogs.atlassian.com/2013/05/alternatives-to-git-submo...
P.S.: Since when is GoDoc a dependency manager for Go?
It should be noted that there are two confusingly similar concepts in the git - the subtree merge strategy and the git subtree command (which is, in fact a git command like git submodule, a point which seems ambiguous in the OP).
> In such a situation, going with submodules (or subtrees) probably is the right solution
As a Magento Developer, I'm afraid submodules wouldn't work for Magento plugins. As they unfortunately have to be installed to multiple top-level project directories. It is a nightmare (and is better served by the composer efforts for dependency management).
We used this so we could track an entire extension's source code in Git, and move them around easily.
edit: I was thinking of modman
Also, you might want to mention how git status is affected by submodules (& diff, log, etc).
Finally, I'm not sure you should make --init --recursive the default. If you don't realize a project contains submodules, you're going to make mistakes.
After a fresh developer has cloned the super project, they just run the `./setup` shell script and it will inform them of any dependencies their system doesn't meet and then start the docker provisioning process. All subprojects have docker containers associated with them, and we have shell scripts that launch all docker containers and link them together.
A new developer can cold provision the entire cluster on their laptop in a matter of minutes, pretty neat :)
Some of this caveats are kinda surprising for me, coming from a Mercurial background:
* Every time you add a submodule, change its remote’s URL, or change the referenced commit for it, you demand a manual update by every collaborator. Forgetting this explicit update can result in silent regressions of the submodule’s referenced commit. -- This is something handled automatically in Mercurial. Is there any reason why the same behaviour is not used in Git?
* Commands such as status and diff display precious little info about submodules by default. -- This should be possible to implement, no? It's also something that's available in Mercurial (using the --subrepos flag), and it's a huge boost to usability.
Not just them. git archive and git grep for example totally ignore submodules. The whole thing is bolted on, with minimal integration into the core commands. So, usually something to avoid.
It sounds painful, though.