I have a very same application under development for two institutions. All the code is 100% similar except for the names in a single properties file. In future, improvements needed are also shared between these two. Is it possible to manage source code for both applications under one git repository, so that improvements and bug fixes will be very easy, but will have different properties files?
Yes, use branches.
First commit everything that is common, including a common (possibly never going to be actually used) version of the file in question:
(1)
Then, create a branch and add the changes to that file:
(2) <-- customer A
/
(1)
Then update back to the original changeset, and create another branch with the other changes to that same file:
(2) <-- customer A
/
(1)
\
(3) <-- customer B
Then you develop from the (1)
branch forward, merging into the respective (customer?) branches as you see fit:
(2)---------(6) <-- customer A
/ /
(1)---(4)---(5)---(8)---(9) <-- development trunk
\ \
(3)---------(7) <-- customer B
etc.
Note that this can quickly become unwieldy if you have many customers, or many such smaller differences, there might be other ways to handle the differences, such as a build system that replaces a file as part of the build, instead of having N branches for such minor differences.
In other words, if the differences are related to things like branding and features that each customer have access to, a build system would prepare different distributables for each customer, already configured with the right files and configuration. This would need no extra branches at all (beyond what you should already have related to development, testing, production, etc.).
I would not put configuration files under version control in this case - just state in the README that a configuration file based on given example template should be provided, e.g. database credentials.
If the template changes, you just update the README.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With