1

What's the best way to apply a cruft (or cookiecutter) template to an existing Git/GitHub project, which doesn't use any cookiecutter template so far?

Andi
  • 3,196
  • 2
  • 24
  • 44

1 Answers1

1

In most cases, this would be a bad idea. Cookiecutter will override the contents of your folder. Any existing files, matching to template files, will be overridden with the template ones. So if you already have real logic inside those files, it gets lost.

If you want to adopt some good practices from the template, better do it manually and not by applying it on the existing project.

wankata
  • 855
  • 4
  • 12
  • How can Cookiecutter override the existing files? Shouldn't it create a pull request so that you can see what the changes would be? – Andi Aug 31 '22 at 10:57
  • Cookiecutter doesn't understand git. If the current project is under version control, you could create a pull request and revert what should be reverted and so on, but this is still pretty weird. I suppose that 90% of the changes won't be meaningful, so I still would do it vice versa and just manually add the other 10%. – wankata Aug 31 '22 at 11:11