How the CLI Keeps You in Sync Across Web and Terminal
The two-editor problem
Htmlhost gives you two ways to edit a site. You can work locally in your code editor and deploy with the CLI. Or you can open the site in the web editor, make changes visually, and publish from the browser.
Both are useful for different tasks. The web editor is great for quick copy tweaks, AI-powered edits, and visual fine-tuning. The local editor is better for structural changes, writing new pages, or working with your own tools and extensions.
But if you use both, you can end up with conflicting versions. You deploy from your laptop, then edit in the browser, then try to deploy from your laptop again. If the CLI blindly overwrites the remote site, your browser edits are lost.
The CLI warns about newer remote changes with a sync check. It does not automatically merge local and remote files.
How the sync check works
Every time you deploy or pull, the CLI records a version number in the .htmlhost link file. This version corresponds to the state of the site at the moment of the last sync.
When you run htmlhost deploy on a linked project, the CLI contacts the server and checks the remote version before uploading anything. If the remote version is higher than the version your local project last synced with, it means something changed on the server since your last deploy or pull.
What you see when changes are detected
If the CLI detects that the remote site has been modified, it pauses the deploy and presents three options:
! Remote changes detected — my-site.htmlhost.co was modified since your last deploy.
Remote version: 5 · Local version: 3
? What would you like to do?
1. Pull changes first, then deploy
2. Deploy anyway (overwrites remote changes)
3. Cancel
Option 1: Pull first
This downloads the remote changes to your local project using the same mechanism as htmlhost pull. After pulling, the CLI asks you to run htmlhost deploy again. Before pulling, commit or back up local edits: pull writes remote files into your directory and can overwrite your local versions. Use htmlhost pull --dry-run to inspect the proposed changes. Afterwards, reconcile the downloaded files with your saved local work before deploying.
Option 2: Deploy anyway
This proceeds with the deploy and overwrites whatever is on the server. Use this when you're certain your local version is the correct one and the remote changes should be discarded.
Option 3: Cancel
This aborts the deploy entirely. Useful when you want to investigate the situation before making a decision.
A typical workflow
Here's what the full loop looks like when you're editing across both environments:
- Deploy your project from the terminal with
htmlhost deploy - Open the site in the web editor and make some visual tweaks
- Go back to your terminal and make additional changes locally
- Run
htmlhost deployagain - The CLI warns you that the remote site was modified
- Commit or back up your local edits before choosing "Pull changes first"
- Review the downloaded files and reconcile them with your saved local edits
- Run
htmlhost deployone more time to push everything together
The backup and reconciliation steps preserve your local work. Pull is a download operation, not a Git-style merge; review the combined result before publishing.
CI/CD pipelines
If you're deploying from a CI/CD system (like GitHub Actions), there's no human to answer the prompt. In this case, use the --no-pull-check flag only when your pipeline is intended to overwrite remote changes. The --publish flag explicitly confirms publication:
htmlhost deploy --no-pull-check --publish
This is also useful when you have a single authoritative source (like a Git repo) and want the CI deploy to always win, regardless of any manual edits made through the browser.
When does the check run?
The sync check only runs when all of these are true:
- You're re-deploying to an existing linked site (not creating a new one)
- Your
.htmlhostfile contains sync metadata (meaning you've deployed or pulled at least once) - You haven't passed
--no-pull-check
For first-time deploys or when using --new, there's nothing to compare against, so the check is skipped.
Keeping everything in sync
The sync check is one piece of a larger workflow that the CLI supports. Together with htmlhost pull and htmlhost clone, it helps you switch between terminal and browser editing. Keep backups or version control, read sync warnings, and review files before publishing.
Ready to try it yourself?
Import your HTML, check the preview, then publish a link you can share and update.
Start hosting