Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 31, 2026

Downstream projects need to receive template updates (especially dependabot-driven dependency updates) while preserving their git history and project-specific modifications.

Implementation

Core Sync Mechanism (tools/template-sync.py)

  • Adds template as git remote, fetches updates, merges via standard 3-way merge
  • Dependabot updates flow as regular commits—no special handling required
  • Conflict detection with manual resolution workflow
  • Dry-run preview mode

Configuration (.templaterc)

  • Defines sync/exclude patterns for template vs project-specific files
  • Tracks last sync commit for incremental updates
[sync]
exclude_paths = src/*/, tests/test_*.py
sync_paths = .github/workflows/*.yaml, pyproject.toml
smart_merge_files = pyproject.toml, .pre-commit-config.yaml

Documentation

  • docs/template-sync.md - Setup, workflow, configuration reference
  • docs/template-sync-examples.md - 10 real-world scenarios (conflict resolution, selective sync, emergency updates)
  • docs/template-sync-quickstart.md - Command reference

Optional Automation (.github/workflows/template-sync-check.yaml.example)

  • Weekly check for template updates
  • Creates GitHub issues when updates available

Usage

# In downstream project
python tools/template-sync.py --dry-run  # Preview
python tools/template-sync.py            # Apply merge

# Handles conflicts via standard git workflow
vim conflicted-file && git add && git commit

Design Rationale

Git merge handles dependency updates naturally—when template's pyproject.toml updates pytest 8.2→8.3 via dependabot, downstream projects receive it as a merge commit. Standard 3-way merge preserves both template updates and local modifications. No external dependencies beyond Python stdlib + Git.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Discuss automating template updates for multiple projects Template synchronization strategy and implementation options Jan 31, 2026
Copilot AI requested a review from fschuch January 31, 2026 12:41
Copilot AI and others added 3 commits January 31, 2026 12:50
Co-authored-by: fschuch <37457501+fschuch@users.noreply.github.com>
Co-authored-by: fschuch <37457501+fschuch@users.noreply.github.com>
Co-authored-by: fschuch <37457501+fschuch@users.noreply.github.com>
@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
1 Security Hotspot

See analysis details on SonarQube Cloud

Copilot AI changed the title Template synchronization strategy and implementation options Add git-based template synchronization for downstream projects Jan 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants