This guide is for repository maintainers who want to enable the "Use this template" feature on GitHub.
A GitHub template repository allows users to create new repositories with the same directory structure and files, but with a clean git history. This is perfect for starter projects and frameworks like RouteMQ.
When RouteMQ is marked as a template:
- ✅ Users see a "Use this template" button on GitHub
- ✅ Easy one-click creation of new projects
- ✅ Automatically starts with a clean git history
- ✅ No need to manually remove
.gitfolder - ✅ GitHub tracks derived repositories
- ✅ Better discoverability
-
Navigate to your repository on GitHub
- Go to
https://github.com/ardzz/RouteMQ
- Go to
-
Click on Settings (repository settings, not profile)
- Located in the top navigation bar
-
Scroll to the "Template repository" section
- It's near the top of the settings page
-
Check the box that says:
- ☑️ "Template repository"
-
Done! The "Use this template" button will now appear
GitHub Repository Page
└─ Settings (tab)
└─ General
└─ Template repository
└─ ☑️ Template repository
"Allow users to create new repositories from this repository"
Once enabled:
- A green "Use this template" button next to the "Code" button
- Clicking it opens a dialog to create a new repository
- The new repository is independent with its own git history
-
Add a clear description to the repository
- "A flexible MQTT routing framework - Use as template for your projects"
-
Add relevant topics/tags
mqtt,framework,template,python,iot,routing
-
Create a good README (already done ✅)
- Explain it's meant to be used as a template
- Provide "Use this template" instructions
-
Add a LICENSE (if not present)
- Makes it clear how users can use the code
If you prefer users to fork instead:
- Don't enable template repository
- Keep the manual setup scripts (already included)
- Users can still use
setup-project.shto clean git history
This repository already includes:
- ✅
setup-project.sh- Bash script for clean setup - ✅
setup-project.ps1- PowerShell script for Windows - ✅
INSTALL.md- Detailed installation guide - ✅ Updated
README.md- Template usage instructions - ✅ This file (
TEMPLATE.md) - Guide for maintainers
After enabling:
-
Test the template button yourself
- Click "Use this template"
- Create a test repository
- Verify it has clean history
- Delete the test repo
-
Check the experience
- Make sure README renders correctly
- Verify setup scripts are executable
- Ensure .env.example is present
- ✅ Keep the repository clean and well-documented
- ✅ Use .gitignore to exclude unnecessary files
- ✅ Provide clear setup instructions
- ✅ Include example configurations
- ✅ Add CI/CD templates if applicable
- ❌ Include sensitive data or credentials
- ❌ Have incomplete or broken code
- ❌ Include large binary files
- ❌ Leave TODO comments everywhere
- ❌ Have failing tests
Consider adding to .gitignore:
# User-specific files
.env
*.log
__pycache__/
*.pyc
# IDE files
.vscode/
.idea/
*.swp
# OS files
.DS_Store
Thumbs.db-
Test thoroughly before committing
- Changes affect all new projects created
-
Keep backwards compatibility when possible
- Users may update their projects
-
Document breaking changes
- In CHANGELOG.md
- In release notes
-
Version appropriately
- Use semantic versioning
- Tag releases
- User visits
github.com/ardzz/RouteMQ - Clicks "Use this template"
- Fills in:
- Repository name
- Description (optional)
- Public/Private
- Clicks "Create repository from template"
- GitHub creates new repo with:
- All RouteMQ files
- Clean git history (single initial commit)
- User's own remote
- User clones and starts working
Users who previously cloned can:
- New projects: Use the template button going forward
- Existing projects: Continue as-is, no changes needed
- Want to switch: Can still use setup scripts to clean history
To make RouteMQ a template repository:
Settings → General → Template repository → ☑️ Enable
That's it! The repository is already prepared with all necessary setup scripts and documentation.
Questions? Open an issue or check GitHub's documentation.