- Create a repository, for example on GitHub, providing readme and license files.
- Clone the repository:
git clone https://github.com/{repoName}.git-
In the folder where your add-on repository is cloned, create an
addonsubmolder and store the code for your add-on. -
Go to the folder where your repository was cloned:
cd {repoFolder}- Commit your changes:
git add .
git commit -m "Initial commit"- Add the template as a remote:
git remote add template https://github.com/nvaccess/addonTemplate.git- Fetch the add-on template:
git fetch templateAs AddonTemplate evolves, it receives improvements, bug fixes, new GitHub workflows, and build system updates.
You can merge the latest template changes into your repository instead of manually copying updated files.
This document explains the recommended update procedure.
Note
Updating from AddonTemplate only affects your project's infrastructure (build scripts, GitHub workflows, configuration files, etc.). It does not modify your add-on's source code.
Before updating your repository:
-
Ensure your working tree is clean.
git status
-
Commit or stash any pending changes.
-
It is recommended to perform the update on a dedicated branch.
If anything goes wrong before the merge commit is created, if you haven't passed the `--squash- flag, you can safely cancel the operation using:
git merge --abortIf you have not already done so, add AddonTemplate as a remote:
git remote add template https://github.com/nvaccess/AddonTemplate.gitThen fetch the latest changes:
git fetch templateMerge the latest version of AddonTemplate:
git merge template/master --allow-unrelated-histories --squashThe --allow-unrelated-histories option is required because your add-on repository and AddonTemplate do not share a common Git history.
The --squash flags will add changes from the template as a unique commit, instead of several ones, what may be useful to keep a cleaner history on your repository.
At this stage, Git may report merge conflicts.
This is completely normal.
During the merge, Git attempts to combine the contents of both repositories automatically.
When Git cannot determine which version should be kept, it reports a merge conflict.
A conflict does not mean that something went wrong. It simply means that some files require manual review.
The restore command can be used to update files on your working directory, i.e., the folder where your add-on repository was cloned.
The --source flag is used to determine where files to be restored can be found.
Your add-on documentation should not be replaced by the template.
To keep your .md files from your add-on repository, ensuring they aren't replaced with files from the template, you can use the following command:
git restore *.md --source=HEADThe docs/ directory belongs to AddonTemplate itself.
It is not intended to become part of your add-on repository.
Remove it:
git rm -r docs
Or use the restore command:
git restore docs --source=HEADbuildVars.py usually contains merge conflicts because it includes both:
- information specific to your add-on;
- variables introduced by newer versions of AddonTemplate.
Review the file carefully.
In general:
- keep your add-on metadata;
- preserve your version number;
- keep your custom settings;
- add any new variables introduced by the template.
pyproject.toml is another file that commonly requires manual review.
Keep your project-specific configuration while incorporating any new settings required by the updated template.
For most remaining files, the version provided by AddonTemplate is generally the correct one.
Typical examples include:
.github/.gitignoremanifest.ini.tplmanifest-translated.ini.tplsite_scons/sconstruct
Review any conflicts if necessary before completing the merge.
Once all conflicts have been resolved, check if the add-on can be built properly:
uv sync # Update dependencies
uv run scons # Build the add-onIf all is right, stage the modified files:
git add .Then create the merge commit:
git commit| File or directory | Recommended action |
|---|---|
README.md |
Keep the add-on version |
CHANGELOG.md |
Keep the add-on version |
docs/ |
Remove |
buildVars.py |
Merge manually |
pyproject.toml |
Merge manually |
| Other template files | Usually accept the template version |
Merge conflicts are expected when updating from a newer version of AddonTemplate.
Most conflicts occur in buildVars.py and pyproject.toml.
Review the conflicting sections carefully and combine the changes from both versions.
If you have not yet committed the merge, and you haven't passed the --squash flag to git merge, you can restore your repository to its previous state:
git merge --abortIf you passed the --squash flag, git merge --abort won't work.
In this case, you can use the restore command:
git restore . --staged # Discard changes added to the staging area (after using `git add .`)git restore . --source=HEAD # Restores the working directory to the last commit made in your add-on repositoryIf you committed changes, you can use:
git reset --hard {cleanBranch}