2

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.

4
  • Okay, so, what's your question? Commented Jan 29, 2015 at 18:29
  • @jthill What would be the best method of going about this? Commented Jan 29, 2015 at 18:30
  • 2
    You are essentially asking how to use Git, if not how to use a source control system in general. Commented Jan 29, 2015 at 18:30
  • 1
    I think the question is a little more nuanced that "how to use Git". It sounds like there is an application that has been customized for a certain client, and bug fixes have become hard to maintain between two different code sets. The customizations probably include newer or different features that aren't in the "official" version of the application. Commented Jan 29, 2015 at 18:38

1 Answer 1

1

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
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.