How to "prefer source" for a few selected dependencies, and "prefer dist" for the rest?
You should simply not allow your own dependencies to have a distribution download link.
That excludes using Github, but will happily work with any pure Git repository. Composer explicitly checks if the repo url points to Github and then tries to download from the known sources instead of cloning the repo, which usually is way faster.
So you probably should reference your local Git repos instead of Github (which I assume you are doing right now).
There is however no way to decide per dependency which method to use.
There is now a preferred-install feature. (I'm not sure if this was available at the time of the original question)
Defaults to auto and can be any of source, dist or auto. This option allows you to set the install method Composer will prefer to use. Can optionally be a hash of patterns for more granular install preferences.
{
"config": {
"preferred-install": {
"my-organization/stable-package": "dist",
"my-organization/*": "source",
"partner-organization/*": "auto",
"*": "dist"
}
}
}
This lets you specify for each dependency the preferred install method.
See the repositories section for available ways the dependencies can be host.