Preview Deployments and Rollbacks
🎯 Introduction
In this article, you will learn the difference between preview deployments and production deployments, generate previews automatically from branches and pull requests, and roll back to an earlier version when something goes wrong.
🧱 Two Deployment Types
Each Vercel deployment belongs to one of two types:
| Type | Trigger | URL affected |
|---|---|---|
| Production | Push to main, vercel --prod | Production domain |
| Preview | Push to another branch, pull request, vercel | A separate temporary URL for each deployment |
Think of them as a rehearsal and a live performance: preview deployments let you experiment, while production deployments face your audience directly.
💡 Trigger a Preview Deployment with a Branch
A typical workflow is to create a branch for a new feature, check it, and then merge it into main. Vercel fits naturally into this workflow.
Create a branch, update the homepage title, and push:
git checkout -b feature/new-title
# Change the title in src/App.vue
git add .
git commit -m "update home title"
git push origin feature/new-title
After pushing, open the Vercel dashboard. You will see a new preview deployment with its own URL. Open it to see the new title while your production domain remains unchanged.
When you open a pull request on GitHub, Vercel also posts a comment with the preview link. Team members can open it to review the changes, which is one of the main benefits of preview deployments.
🕘 View Deployment History
Open your project's Deployments page to see previous deployments. Each record includes:
- The commit message and branch name.
- The deployment type (Production / Preview) and status.
- The build duration and deployment time.
Open any record to inspect its Build Logs. If the live site has a problem, start here to find the most recent successful deployment.
↩️ Roll Back with One Click
If a new release breaks something, you can restore service before changing the code. Vercel supports instant rollbacks:
⋯ menu for the corresponding action if the wording differs.- Find the last working production deployment in Deployments.
- Open its
⋯menu on the right and choose Instant Rollback. - The live site returns to the earlier version within seconds.
A rollback points your production domain back to an earlier deployment's output. No rebuild is needed, so the change is almost immediate. This lets you restore service first and investigate afterward.
❓ Knowledge Check
Q1: Do preview URLs remain available forever?
They remain available for some time, but are intended for temporary testing. Merge features into main and use production deployments for long-term use.
Q2: Can I disable preview deployments?
Yes. Under Settings → Git, you can adjust which branches trigger deployments. The defaults suit most teams.
Q3: Can I undo a rollback?
Yes. The deployment records remain available. Use Promote on the newer deployment to switch back to it.
Q4: Does it matter if my repository's main branch has another name?
Yes. Vercel uses the repository's main branch as its production branch by default. If yours has a different name, update Production Branch under Settings → Git accordingly.
🧪 Practice
- Create a
feature/lucky-numberbranch, add your lucky number to the homepage, and push. Find the preview deployment in the dashboard and visit its URL. - Merge into main and confirm that the production domain updates. Then roll back to the previous production deployment and observe the change.
# Write your Git commands here
🎉 You now know how to use preview deployments and rollbacks! Next, we will connect your own domain to the project.
