Denis Gorbachev
Denis Gorbachev

Reputation: 507

Patch two files with one diff

I've got two files: config.yml-sample and config.yml. The first one is being constantly updated, while the second is listed in .gitignore. When I add a line in config.yml-sample and push the commit, I want to have it duplicated in config.yml automatically on pull at other developers' workspaces.

How do I achieve this?

Upvotes: 0

Views: 96

Answers (2)

Mark Longair
Mark Longair

Reputation: 467023

Another simple option is to have your application read config.yml.sample on startup to find all the configuration keys (or whatever) that are mentioned there. Then after loading config.yml you can see if any of those required keys are missing, and prompt the user to copy those lines in from config.yml.sample, possibly customizing them when doing so.

Upvotes: 1

Fred Foo
Fred Foo

Reputation: 363487

Either remove config.yml from .gitignore, or use a hook to update the file from config.yml-sample. It seems to me that a post-checkout hook would be appropriate.

Upvotes: 0

Related Questions