Updating Projects¶
This guide explains how to keep your cookbook repository up-to-date with the latest template version using Copier. As the template evolves, you can easily update your project while preserving your customizations.
Why Update Your Template?¶
To ensure your cookbook repository remains compatible with the latest project configurations, such as website generation, CI/CD workflows, and automation tools, updating to the newest template version is critical. Here’s why:
- Configuration Consistency: New templates include updated settings for website builders (e.g., Sphinx, MkDocs) and workflow tools (e.g., GitHub Actions), ensuring your project aligns with the TU Cookbooks’ current standards.
- Long-Term Maintenance: Receive ongoing support for build and workflow tools, ensuring your cookbook remains viable as the project evolves.
Updating Your Cookbook with Copier¶
To update your cookbook repository using copier, you'll need to run the update command with your existing project path. This process synchronizes your project with the latest template changes while preserving your custom content.
// Get latest updates from the template
$ copier update
When updating, copier will apply template changes to your project. For an in-depth look how that works visit the copier documentation
Important considerations:
- Always commit your changes before updating
- Review the diff carefully to understand template changes
- Some template updates may require manual adjustments
For projects with uncommitted changes, first stash or commit your work:
// Temporarily save local changes
$ git stash
// Run the update
$ copier update .
// Restore your changes after the update
$ git stash pop
After updating, test your notebook thoroughly to ensure all template changes integrated correctly.