Overview
Thepush-template command allows you to contribute improvements from your local project back to the remote template repository. It creates a fork, syncs your changes, and helps you create a pull request.
Syntax
Parameters
The directory of the project or app whose changes you want to push to the template. Must have been created with
bootstrap-project or bootstrap-app.Prerequisites
GitHub CLI
Install the GitHub CLI:rsync
Verify rsync is installed (usually pre-installed on Unix systems):How It Works
Thepush-template command follows this workflow:
- Reads template metadata from
.copier-answers.ymlto identify the source repository - Creates a temporary fork of the template repository using
gh repo fork - Syncs your local changes to the fork using
rsync, respecting exclusions fromcopier.yml - Opens the fork in GitHub Desktop (if installed) for you to review and commit changes
- Prompts for confirmation after you’ve pushed your commits
- Creates a pull request using
gh pr create --web --fill - Cleans up the temporary fork directory
Workflow Steps
Step 1: Prepare Your Changes
Ensure your local changes are ready:Step 2: Run push-template
Step 3: Review and Commit
The command will:- Fork the template repository to a temporary directory
- Sync your changes to the fork
- Open the fork in GitHub Desktop (if available)
Step 4: Confirm Push
After pushing your commits, the command will prompt:y to continue.
Step 5: Create Pull Request
The command opens your browser to create a pull request with pre-filled information.Examples
Push Project Changes
Contribute improvements from your project:Push App Changes
Share app-level improvements:Push from Specific Path
File Synchronization
The command syncs files usingrsync with the following behavior:
Automatically Excluded
These files are always excluded from syncing:.DS_Storevenv/superapp_fork/.git/.copier-answers.yml{{_copier_conf.answers_file}}.jinja
Copier Configuration Exclusions
Additional exclusions fromcopier.yml:
- Files matching patterns in
_exclude - Files matching patterns in
_rsync_exclude - Files prefixed with
!are explicitly included despite other exclusions
Example copier.yml
Error Handling
GitHub CLI Not Installed
rsync Not Installed
No Remote Repository Configured
bootstrap-project or bootstrap-app and have a .copier-answers.yml file with template information.
User Aborted
If you selectN when asked if you’ve pushed your commits:
Best Practices
1. Create Focused Changes
Make small, focused contributions:2. Document Your Changes
Write clear commit messages and PR descriptions:3. Test Before Pushing
Always test your changes:4. Review Sensitive Data
Before committing to the fork, check for:5. Coordinate with Template Maintainers
For large changes:- Open an issue first to discuss
- Follow the template’s contribution guidelines
- Be responsive to review feedback
Common Use Cases
Contributing Bug Fixes
Found and fixed a bug in the template?Sharing New Features
Added a useful feature others might benefit from?Improving Documentation
Enhanced docstrings or added documentation?Cleanup
The command automatically cleans up the temporary fork directory, even if errors occur:finally block to ensure cleanup runs regardless of success or failure.
Related Commands
pull-template
Update your project with template changes
bootstrap-project
Create a new project from a template