Add the ability to (git) merge files when executing different templates
Actual Situation
I'm opening this issue as per discussed here: https://github.com/orgs/copier-org/discussions/1485#discussioncomment-10101273
Copier is really nice, because you can have multiple templates and apply them to the same repo, but it has a limitation. When both templates try to modify the same file, the second template overrides the previous one.
Imagine a team maintains 2 templates: python-base and python-app.
python-base: creates thepyproject.tomlwith the name and all the information that is required once.python-app: creates a python module and it needs to update thepyproject.toml, for this example, let's say it needs to add dependencies (it could also need to update thetool.poetry.packages).
Now these 2 templates live in different repositories and both create the file pyproject.toml.
If you run the templates python-base and after the python-app, the end result of pyproject.toml will only be the content of python-app and we lose what was created on python-base.
Desired Situation
When applying the second template, it should be possible to merge the files (maybe with a conflict) instead of just overwriting.
Proposed solution
I'm not entirely sure how it would work. But it would be nice to have the ability to "merge" the same files.
Right now, if copier detects the same file, it asks if it should be overwritten. It would be nice, if there's a third option, called "merge", where it tries to merge the files, similar to git (possibly using the same conflict mechanism, so we can use existing tool to resolve the conflict). Ideally, having a flag to tell copier to merge if it finds conflicts, like --merge-files.