How do you keep similar files in sync when developing similar projects?

I currently am developing two different projects which have similar files such as the Docker and docker-compose.yml all that is different is the project name. I would quite like them to always be in sync. Should I just remember that the other file is similar or is there a tool you recommend me using?