Overview
Thepull-template command updates your local project or app with the latest changes from its remote template repository. This is useful for receiving upstream improvements, bug fixes, and new features from the template.
Syntax
Parameters
The directory of the project or app to update. This directory must have been previously created using
bootstrap-project or bootstrap-app, which stores template metadata.How It Works
- Reads the
.copier-answers.ymlfile in the target directory to identify the source template - Fetches the latest changes from the remote template repository
- Updates local files while preserving your customizations when possible
- Uses the
--overwrite=Trueflag to handle conflicts automatically
The command uses Copier’s update functionality, which intelligently merges template changes with your local modifications.
Examples
Update Current Project
Update the project in the current directory:Update Specific Project
Update a project in a specific location:Update an App
Update a specific app within your project:Update Multiple Apps
Update multiple apps in sequence:Update Behavior
The command uses--overwrite=True, which means:
- Template files: Updated to match the latest template version
- Generated files: Regenerated based on current answers and template
- Custom files: Preserved if not part of the template
- Modified template files: May be overwritten (see backup recommendations below)
Before Updating
Recommended Workflow
-
Commit your current work:
-
Pull template updates:
-
Review changes:
-
Test your application:
-
Commit the updates:
Handling Conflicts
If you’ve heavily customized template files:- Back up your customizations before updating
- Run the update
- Manually merge any custom logic that was overwritten
- Use git diff to see what changed
Example Conflict Resolution
Template Metadata
The command relies on.copier-answers.yml in your project directory. This file stores:
- Source template repository URL
- Template version/commit
- Your answers to template questions
pull-template.
Common Use Cases
Regular Maintenance
Periodically update to receive:- Security patches
- Bug fixes
- New features
- Best practice updates
After Template Changes
When the template repository announces updates:Synchronizing Multiple Projects
Keep multiple projects aligned with the same template version:Troubleshooting
Error: Cannot Find Template Information
If the directory doesn’t have.copier-answers.yml:
bootstrap-project or bootstrap-app. You cannot use pull-template on it.
Unexpected Overwrites
If important customizations are being overwritten: Solution: Consider contributing your changes back to the template usingpush-template, or maintain a fork of the template repository.
Related Commands
push-template
Push your changes back to the template
bootstrap-project
Create a new project from a template