To track updates to an Astro theme, keep the theme’s repository as a Git remote called upstream and your own site repository as origin. When the theme ships a fix or an Astro upgrade, run git fetch upstream, review what changed, and git merge upstream/main into your branch. Your edits stay, and you resolve conflicts only where you and the theme changed the same lines.
Key Takeaways
- Clone the theme, rename its remote to
upstream, and push to a new repo asorigin.- Fetch and inspect upstream changes before merging them.
- Merge on a branch, run
npm installandnpm run build, then merge tomain.- Conflicts are rare when your edits sit in config, tokens and content.
- Don’t use a GitHub fork for client sites that need to stay private.
Set up the remotes once
Clone the theme repository you were given access to, then point origin at your own empty repository:
# Terminal
git clone [email protected]:theme-author/aurora-theme.git my-site
cd my-site
git remote rename origin upstream
git remote add origin [email protected]:your-name/my-site.git
git push -u origin main
git remote -v
git remote -v should list both:
origin [email protected]:your-name/my-site.git (fetch)
origin [email protected]:your-name/my-site.git (push)
upstream [email protected]:theme-author/aurora-theme.git (fetch)
upstream [email protected]:theme-author/aurora-theme.git (push)
You can never push to a theme repo you only have read access to, but to rule out accidents, disable it locally:
# Terminal
git remote set-url --push upstream no_push
Why not a GitHub fork? Forks of a private repository are tied to it, and you usually want a site repo you fully own, can transfer to a client, and that keeps working if your access to the theme repo changes. A plain second remote gives you updates without that link.
Check what changed upstream
# Terminal
git fetch upstream
git log --oneline main..upstream/main
git diff --stat main...upstream/main
The log shows commits you do not have yet; the three-dot diff shows what upstream changed since your branches split, file by file. Read the theme’s changelog or release notes if it has them. A line like “Upgrade to Astro 7.4” tells you to expect package.json and lockfile changes.
Merge on a branch
# Terminal
git switch -c theme-update
git merge upstream/main
npm install
npm run build
npm run preview
If the build passes and the preview looks right, merge into main and deploy:
# Terminal
git switch main
git merge theme-update
git push
Running npm install after the merge matters: an update may change dependency versions, and your old node_modules will not match the new lockfile. If the update includes an Astro major version, our Astro upgrade guide lists what to check.
Resolve conflicts
A conflict means you and the theme both changed the same lines. Git marks the file:
# Terminal
git status
git diff --name-only --diff-filter=U
Common cases and what to keep:
| File | Usually keep |
|---|---|
src/config.ts, site settings |
Your values |
tailwind.config.mjs, CSS tokens |
Your colours and fonts, upstream’s new keys |
| Layouts and components you never edited | Upstream (git checkout --theirs <file>) |
package.json |
Upstream versions, plus any packages you added |
package-lock.json |
Take upstream’s, then run npm install |
After fixing each file, git add it and run git merge --continue. If a merge goes badly, git merge --abort puts everything back.
The fewer core files you rewrite, the fewer conflicts you see, which is why we suggest customising from the outside in.
If you started without the theme’s history
If you downloaded a ZIP or copied files into a new repo, Git sees no shared history. You can still connect them once:
# Terminal
git remote add upstream [email protected]:theme-author/aurora-theme.git
git fetch upstream
git merge upstream/main --allow-unrelated-histories
Expect conflicts in every file you changed on this first merge. Later merges behave normally.
Every Komal theme is delivered as a private GitHub repository with free lifetime updates, so this setup is how you receive them; the getting started docs cover the first clone, and you can browse Astro themes if you have not picked one.
FAQ
What is a git upstream remote?
It is a second remote in your repository, conventionally named upstream, that points at the project you started from. You fetch from it to receive changes, while pushing your own work to origin.
How do I update an Astro theme without losing my changes?
Fetch the theme repository as upstream, merge upstream/main into a branch, resolve any conflicts, run npm install and npm run build, then merge that branch into main.
Should I rebase or merge theme updates?
Merge. Rebasing rewrites your commits on top of upstream, which is awkward once your site repo is shared or deployed. A merge keeps both histories and is easy to undo.
How often should I pull Astro theme updates?
When the theme publishes a release you need, and at least before a major Astro upgrade. Small, regular merges are easier to review than a year of changes at once.