Reputation: 11217
We use master for developement. We merge stable topic braches to master. For our clients we branch from master. We need to let some external collaborators (typically frontend devs) collaborate on client's branch. But they MUST NOT have any access (read or write) to other branches or master (ideally not even to project's history before the client's branch diverged).
My idea was that we could create a new repo, where "revision 0" would be the one, where the client's branch diverged and use pull requests to pull changes to the canonical repo. Is there any way to do that? I mean to create empty repo starting with some concrete revision of other repo.
I think it should be possible - because the content will be the same - so will the hash. But simple copy&paste of a revision would not work, or will be error-prone as the newly created request would need to be EXACTLY the same as the one in the canonical repo to have same hash.
Please note we use Github as our git hosting and we have no intentions to create our own git hosting.
Upvotes: 3
Views: 3519
Reputation: 5059
You are going to need one private repository per client, if you want to hide the clients from each other and your master. You'll have one internal repository that contains your own development, and an orphaned branch for each of your clients. When you want to create a new client branch, you'll do
git checkout --orphan client_xx
git commit
Then you'll have an orphaned branch containing the exact contents of your master branch at that time. To create a client repository you need to do a little trick with a temporary branch
mkdir -p /path/to/client_xx
cd /path/to/client_xx
git init
git fetch /path/to/internal client_xx:tmp
git checkout tmp
git branch master
git checkout master
git branch -d tmp
Now the master branch of the client repository will contain the exact same sha1 as the client branch of your internal repository. You can have the client fork the client repository and make pull requests to you. You can integrate the client repository into your internal repository by pulling to the client branch. You cannot properly merge the client branch into master branch (or vice versa) as the client branch was orphaned, but you can do the integration using cherry-pick.
Upvotes: 8