Note on git commands to use branches as independent light-weight repositories within a real repository.
Assume the remote repo. already exists, e.g. https://example.com/user/a_repo.git
.
Create a new empty repository and do things there:
git init subrepo
cd subrepo
date >README.md
git add README.md
git commit -am'one file'
To make this repository into an independent (no parent) branch called subthing
in the remote repo.
git remote add origin https://example.com/user/a_repo.git
git checkout -b subthing
git push origin subthing
To get just one branch from a remote repo. using these "branch-repositories":
git clone --branch subthing --single-branch https://example.com/user/a_repo.git subthing
https://stackoverflow.com/questions/17714159/how-do-i-undo-a-single-branch-clone
git remote set-branches --add origin [remote-branch]
git fetch origin [remote-branch]:[local-branch]