Multiple Domains

If the two apps are identical and the only difference is the database, then creating multiple environments, all pointing to the same branch, each with its own database is a good solution.

But creating one branch per client allows to have slightly different apps while maintaining only one. For example you could customize the styles or a form in one client’s branch and not in the other.

Workflow example:

  • create one dev and one client1 branch
  • work on the dev and when you are ready merge to client → at this point you have the app ready for the first client
  • your marketing works hard and finds a second client
  • create the third branch client2 on the same commit as client1 → now the two clients are using identical apps (and possibly different databases if that’s their environment setup)
  • you decide to add a feature for both:
    • make dev the editing environment
    • add your feature
    • make client1 the editing environment
    • right click on dev and merge to client1
    • make client2 the editing environment
    • right click on dev and merge to client2 → at this point both clients have the new feature
  • the second client only wants a new feature:
    • create a dev2 branch where client2 is
    • make dev2 the editing environment
    • add the new feature
    • make client2 the editing environment
    • right click on dev2 and merge to client2 → at this point only client 2 has the new feature
    • delete the dev2 branch. At this point it’s a good idea to delete dev too, just to decrease the chances of merge conflicts in the future
  • you want to add a new feature for both:
    • create a new dev branch either on client1 or client2, it doesn’t matter, just pick one
    • follow the steps above. At the end only the lines edited in the dev branch will be merged, you are not copying, you are merging only the modified lines

The difference between the clone approach and the multiple branches approach is that:

  • when you add a feature to both original and cloned app, you need to remember all the parts you touched on one app and do the same on the other. If the apps are identical, you can just copy the files, but if you customized one of the apps, then you need to manually apply the changes to the second app one by one
  • when you want to add a feature to both client branches, you edit once in the dev branch, then you merge it to both client1 and client2. Git will take care of merging only the lines that you modified since the last merge and leave any previous customization as is

PS: Notice that I have not mentioned the master branch in this workflow. I think that the master branch should be removed. It’s confusing and only makes sense in most other git workflows, I don’t think it belongs in Anvil.

You could reset it to an older branch so it’s out of the way, just like this:

image