Update cookiecutter-generated files with cruft#

Ref: original docs and github repo.

Apply updates: cruft diff & cruft update#

Now that .cruft.json exists, we can run cruft diff to see the changes between your repo and the template. At this point, you could manually apply the subset of the changes you want.

You can also ask cruft to apply the changes for you by running cruft update. You will be prompted to confirm the changes with y before they are applied. You can also press v to see the changes before confirming.


cruft update will not delete the files you have added to your repo since its creation. It only cares about the files that were generated by cookiecutter.

It also doesn’t delete the files that have since been removed from the template. You have to do this manually.

In case cruft update is not able to apply all the changes, it will create a your_file.rej file for each conflicting file. Based on these files’ contents you can then apply changes manually. Don’t forget to remove the .rej files when you’re done. This is a bit tedious, but it should get easier with more frequent updates.

When cruft update is done, you will notice that the .cruft.json file has been updated with the new commit hash of the template. Future updates will be based on this commit hash.

cruft check will check if your repo is up to date with the template and just give you a boolean response.


Once you are satisfied, commit the changes to a new branch and open a PR to merge it into main.

Now, check if your GitHub actions fail… 🤦🏻‍♀️ If everything is fine, you can merge the PR. 🎉 If not, you will have to fix the errors and repeat the process. 😱