Question

I have an iOS that app that I need to deploy to several clients. Each clients has a few small changes in the app (images, provisioning files, app name, etc). 95% of the app is the same for all clients.

I don't want to maintain several git repositories (one for each client). I would rather have the once, with branches for each customer.

I'm new to this branching thing and need to know if this can be achieved.

  1. I plan to create the master branch with generic images/configs/etc.
  2. Create a branch for each client
  3. Update each branch with the customers images/configs/etc

Then when I make a change I will make it to the master. Then pull the changes from the master to each branch. How can I stop the images, configs, etc from being overridden when I pull from master. Can I define certain files which can be ignored when I do this for each branch?

Is there a better way of managing what I need to do?

Was it helpful?

Solution

You should pull master and then rebase your branches on top of it.

See "Git: How to rebase many branches (with the same base commit) at once?" for a concrete example.

For extra security, you can add a merge driver "keepMine" associated for your files, and declare that merge driver in a .gitattributes file present in each of your branches.
See "How do I tell git to always select my local version for conflicted merges on a specific file?".

That will change the SHA1 of your client branches, and you will have to force push them to the client repo, but since said clients aren't actively modifying files on their side, it isn't a problem.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top