1

I understand the branching logic of how to set this up where I would have the production branch as the master and have a development branch for developers but how do I take into consideration:

  1. Configuration files

    • Production using different database settings (git ignore and leave configs static alone?)
  2. How to version and control files in different directories of the server?

    • /var/apps: contains PHP code of different applications
    • /var/www/bapp-t: development web root
    • /var/www/bapp-p: production web root
    • /var/map: some mapping code

How would I version the web roots AND the application framework when they are in different areas of the filesystem using git? Git requires you to have the repo name as the master folder but in my setup there is no way to abide by that? Should I just use symlinks to hook the roots?

  • This is a similar question: http://stackoverflow.com/questions/9636492/branching-different-config-files-for-release-development – Pigueiras Sep 18 '13 at 22:13

1 Answers1

0

One possible solution is to version control a script for updating production. For example, on production you checkout all relevant files:

~/production-master/var/apps
~/production-master/var/www/bapp-t
~/production-master/var/www/bapp-p
~/production-master/var/map
~/production-master/update-production.sh

After checkout, invoke the update-production.sh script to do safe updates to your production environment. Important: Make sure you test this script carefully!

You can use a hook to automatically invoke the script after the right git commands. For example, a post-receive hook could be used to invoke the script after you push an update to production.

Note that git cannot version control unrelated directories. Sub-directories of a common directory are ok. In your case, you could consider using multiple repositories.

Kevin A. Naudé
  • 3,992
  • 19
  • 20