Reputation: 49
I have a project that I am currently working on utilizing the GitFlow method. We recently have gotten a client where they will be using our code base with a few changes made specific to them.
What I am looking to do is have their code automatically updated with hotfixes and features implemented in our master branch, while still having their code separate and changes made not interfering with the master branch.
So basically hotfix -> merges to master/client branch
In addition if there was any way to treat the client code as a separate repo, so that a development branch could be setup with it that would be even better, but it needs to be able to receive the changes to the master branch as well.
Upvotes: 2
Views: 1023
Reputation: 18888
Using a "fork" of your normal repository sounds like a great way to go, actually. This is the basis for how GitHub works.
On your central Git server:
mkdir clients_repo.git
cd clients_repo.git
git init --bare
Make the initial "fork" of your official repository, which will only bring over the "master" branch:
git clone git@server/official_repo.git
cd official_repo
git remote add clients_repo git@server/clients_repo.git
git push clients_repo master
You can make any number of branches in the clients_repo
you want.
Work on the Client's Repository:
git clone git@server/clients_repo.git
cd clients_repo
git remote add upstream git@server/official_repo.git
git fetch upstream
# create branches, edit, commit, merge, whatever
When it comes time to integrate changes from your official repository into the client's, just merge upstream/master
into your clients_repo master branch:
cd clients_repo
git checkout master
git fetch upstream
git merge upstream/master
# Resolve conflicts and commit if necessary
git push origin HEAD
Upvotes: 1