Mercurial (Hg) is a legacy version control system that Bitbucket dropped support for in 2020, making it incompatible with V0's GitHub-based code export workflow. The practical path is migrating your Mercurial repository to Git, then using V0's native GitHub integration for code export, version control, and Vercel auto-deployment. This guide covers the Mercurial-to-Git migration and V0 workflow setup.
Migrating from Mercurial to Git for V0 and Vercel Integration
Mercurial's decline as a version control system accelerated dramatically after Bitbucket, its primary hosting platform, announced end-of-life for Mercurial repositories in 2019 and shut them down in 2020. Today, the developer tools ecosystem has consolidated almost entirely around Git — GitHub, GitLab, and Bitbucket (now Git-only) all use Git as their foundation. V0 by Vercel is built on this Git-centric ecosystem: its code export feature works exclusively through GitHub, and Vercel's auto-deployment triggers from GitHub pushes.
If your codebase lives in a Mercurial repository, you have two options for working with V0: migrate the Mercurial repository to Git (recommended, preserving your history), or start fresh in a new GitHub repository and export V0-generated code into it. For teams with significant Mercurial history they want to preserve, the migration is worth the one-time effort — tools like fast-export and hg-git can convert Mercurial repositories to Git with full commit history, author information, and branch structure intact. The resulting Git repository is indistinguishable from one that was created with Git from the start.
After migration, your workflow becomes standard: push to GitHub, V0's Git panel reads from and writes to your GitHub repository, and Vercel auto-deploys on every push to the main branch. For teams still running Mercurial servers internally (Bitbucket Server, Rhodecode), you can use Git alongside Mercurial during a transition period by maintaining parallel repositories, though this adds coordination overhead. The clean break approach — full migration to Git followed by archiving the Mercurial repository — is simpler and eliminates ongoing dual-system maintenance.
Integration method
V0 uses Git and GitHub as its exclusive version control and code export mechanism — there is no native Mercurial integration. For teams working with Mercurial repositories, the workflow is to migrate the Mercurial repository to Git (preserving history using the hg-git bridge or fast-export tool), push to GitHub, and then use V0's Git panel to export generated code into the GitHub repository. V0's changes then flow through GitHub to Vercel auto-deployment. This guide covers the migration path and ongoing workflow.
Prerequisites
- Python installed on your machine (required for Mercurial and the fast-export conversion tool)
- Mercurial installed (pip install mercurial or https://www.mercurial-scm.org/downloads)
- Git installed (available at git-scm.com — already installed on most developer machines)
- A GitHub account and a new empty GitHub repository to receive the migrated code
- A V0 account at v0.dev and a Vercel account for deployment after migration
Step-by-step guide
Convert the Mercurial Repository to Git
Convert the Mercurial Repository to Git
The most reliable Mercurial-to-Git conversion tool is fast-export (also called hg-fast-export), which is included with the git-remote-hg package and available as a standalone script. Start by cloning or accessing your Mercurial repository locally — run hg clone your-repo-url local-hg-repo or just ensure your existing Mercurial working directory is up to date with hg pull && hg update. Next, create a new empty Git repository that will receive the converted history: mkdir my-project-git && cd my-project-git && git init. Then download fast-export from its GitHub repository (github.com/frej/fast-export) — it's a Python script that reads Mercurial history and creates Git commits. Run the conversion from inside your new Git repository: /path/to/fast-export/hg-fast-export.sh -r /path/to/local-hg-repo. The script reads all Mercurial changesets and creates equivalent Git commits with the same timestamps, author information, and commit messages. Bookmarks in Mercurial (Hg) become branches in Git, and named branches become Git refs. After conversion completes, run git checkout HEAD to update the working tree to the latest state. Verify the conversion by running git log --oneline and checking that your commit history looks correct. Compare commit counts with your Mercurial repository using hg log --template '{node} ' | wc -l to ensure nothing was lost.
1# Step 1: Install fast-export2git clone https://github.com/frej/fast-export.git ~/fast-export34# Step 2: Create a new empty Git repository5mkdir my-project-git6cd my-project-git7git init89# Step 3: Run the conversion (replace path with your Mercurial repo location)10~/fast-export/hg-fast-export.sh -r /path/to/your/mercurial-repo1112# Step 4: Check out the converted files13git checkout HEAD1415# Step 5: Verify the conversion16git log --oneline | head -20Pro tip: If the conversion fails due to encoding errors in older commit messages, add the --force flag to hg-fast-export.sh. If author names in the Mercurial history don't match Git email format, create an authors mapping file and pass it with the -A flag.
Expected result: The Git repository contains all commits from the Mercurial history with correct timestamps and author information. Running git log shows the complete project history and git checkout HEAD shows all project files in the working directory.
Push to GitHub and Connect V0
Push to GitHub and Connect V0
With your Git repository created locally from the Mercurial conversion, push it to GitHub so V0 can access it. Go to github.com/new and create a new repository — leave it completely empty (no README, no .gitignore, no license) since you'll be pushing the entire converted history. Copy the repository's HTTPS or SSH URL from GitHub. Back in your terminal, add GitHub as a remote and push: git remote add origin https://github.com/username/your-repo.git && git push -u origin main (or 'master' depending on what branch name the conversion created). If the conversion created branches with Mercurial names (like 'default'), rename the primary branch to 'main' before pushing: git branch -m default main. After pushing, verify on GitHub.com that your repository shows the complete commit history from the Mercurial conversion. Now connect V0 to this repository: open V0 at v0.dev, navigate to your project's Git panel, click 'Connect GitHub', authorize V0's GitHub OAuth app, and select your newly pushed repository. V0 can now export generated code as commits or pull requests to this repository, and Vercel will auto-deploy from GitHub pushes. Set up Vercel deployment by going to vercel.com/new, importing the GitHub repository, and configuring the build settings for your Next.js project.
1# Add GitHub remote (replace with your actual repository URL)2git remote add origin https://github.com/username/your-project.git34# Rename default branch to main if needed5git branch -m default main67# Push all history and branches8git push -u origin main9git push --all origin # Push any additional branchesPro tip: If your Mercurial project had a .hgignore file, review it and create an equivalent .gitignore after migration — Git uses a different ignore syntax and the file location matters (project root vs. any subdirectory).
Expected result: The GitHub repository shows all migrated commits from the Mercurial history. V0's Git panel shows the connected repository and can push new code as branches or commits. Vercel detects the Next.js project and is configured for auto-deployment.
Generate and Export Code with V0
Generate and Export Code with V0
With your repository migrated to GitHub and connected to V0, you can now use V0's AI code generation and export it directly to your project. Open V0 at v0.dev and describe the component or page you want to generate — be specific about the visual design, the data it displays, and any interactions it needs to support. V0 generates React components with Tailwind CSS and shadcn/ui that fit naturally into Next.js App Router projects. When you're satisfied with the generated component in V0's preview, click the Git panel in V0's interface and select 'Push to GitHub'. V0 creates a new branch in your repository (named v0/main-HASH or similar), commits the generated files, and opens a pull request for your review. This pull request workflow is ideal for teams — reviewers see exactly what V0 generated before it merges to the main branch. After reviewing, merge the PR and Vercel auto-deploys the new code. For teams coming from Mercurial's bookmark-based branching model, Git's branch workflow feels similar — branches are cheap and short-lived, pull requests replace Mercurial's code review tools, and merges are the integration mechanism.
Create a project dashboard page with a sidebar navigation showing project name, recent activity, and team member avatars. The main content area shows a Kanban board with three columns (To Do, In Progress, Done) with drag-and-drop card support. Each card shows title, assignee avatar, and priority badge. Include a 'New Task' button that opens a modal form with title, description, assignee selector, and priority dropdown. The page fetches initial board state from /api/projects/board and uses optimistic updates for card moves.
Paste this in V0 chat
Pro tip: After migration from Mercurial, set up branch protection rules in GitHub (Settings → Branches → Add rule) to require pull request reviews before merging. This recreates the code review workflow your team had with Mercurial's review tools but in a Git-native way.
Expected result: V0 generates a component and pushes it as a pull request to your GitHub repository. Merging the PR triggers a Vercel deployment and the new component appears in your live app within 60 seconds.
Common use cases
Migrating an Existing Mercurial Project to Work with V0
A team with an existing web project in a Mercurial repository wants to use V0 to accelerate UI development. The migration converts the Mercurial repository to Git, pushes it to GitHub, and then uses V0's Git panel to export generated components directly into the existing codebase structure, maintaining commit history throughout.
Copy this prompt to try it in V0
Starting a New V0 Project for a Team Transitioning from Mercurial
A team in the process of migrating from Mercurial to Git uses V0 to bootstrap a new Next.js project. V0 creates the initial project structure, pushes it to a new GitHub repository, and the team members learn the Git workflow through V0's visual interface before transitioning their other repositories.
Copy this prompt to try it in V0
Setting Up Vercel Deployment for a Mercurial-Migrated Repository
After migrating a legacy Mercurial project to GitHub, configure Vercel auto-deployment and use V0 to modernize the frontend with new React components while keeping the backend logic intact. V0 generates the new UI components and pushes them as pull requests for team review.
Copy this prompt to try it in V0
Troubleshooting
hg-fast-export.sh fails with 'Mercurial not found' or Python import errors
Cause: The fast-export script requires both Mercurial and Python to be installed and accessible in the PATH. On some systems, Mercurial installs as 'hg' but the Python package isn't importable.
Solution: Install Mercurial via pip (pip install mercurial) to ensure the Python package is accessible. Verify with python3 -c 'import mercurial'. If you installed Mercurial via a package manager, ensure both Python and Mercurial are using the same Python version. On macOS, use pip3 and python3 explicitly.
Git push to GitHub is rejected with 'Updates were rejected because the remote contains work'
Cause: The GitHub repository was initialized with a README or other file, so it has commits that conflict with the local Git history created by the Mercurial conversion.
Solution: Create a completely empty GitHub repository — no README, no .gitignore, no license file. On github.com/new, leave all the 'Initialize this repository with' options unchecked. Then retry the push. If you already created a repository with files, use git push --force origin main (use force carefully — this is safe only for brand-new repositories with no important content).
Mercurial commit authors appear as 'Unknown' or with incorrect email in the Git history
Cause: Mercurial allows commit authors without email addresses (just a name), while Git requires the 'Name <email>' format. The conversion tool maps unknown formats to a default.
Solution: Create an authors mapping file that maps Mercurial author strings to Git format. Pass it to hg-fast-export with the -A flag: hg-fast-export.sh -r /path/to/repo -A authors.txt. The file format is: mercurial_author_string=Git Name <git@email.com> with one mapping per line.
1# authors.txt format example:2John=John Smith <john.smith@company.com>3jsmith=John Smith <john.smith@company.com>4John Smith=John Smith <john.smith@company.com>Best practices
- Migrate the entire Mercurial repository history to Git rather than starting fresh — preserving commit history helps with code archaeology, blame investigations, and understanding why past decisions were made
- Create a .gitignore file after migration by reviewing your old .hgignore — the syntax differs (no 'syntax: glob' header needed in .gitignore, and patterns work slightly differently)
- Archive the original Mercurial repository after migration rather than deleting it — keep it as a read-only reference for at least 6 months in case you need to reference old history or branches
- Use GitHub's branch protection rules to enforce pull request reviews, matching the code review culture your team had with Mercurial code review tools
- Update any CI/CD pipelines or build scripts that referenced hg commands (hg pull, hg update) to their Git equivalents (git pull, git checkout) before archiving the Mercurial workflow
- Set up Vercel's GitHub integration immediately after pushing to GitHub — this gives you automatic preview deployments for every pull request, which is better than Mercurial-based workflows typically offered
Alternatives
Use Git directly instead of managing a Mercurial migration — Git is V0's native version control system with direct GitHub integration, branch-based workflows, and Vercel auto-deployment support built in.
Use GitLab alongside Git if your team needs self-hosted version control with built-in CI/CD pipelines — GitLab supports Git repositories and can mirror to GitHub for V0 integration.
Frequently asked questions
Is Mercurial still actively used and supported?
Mercurial is still maintained as an open-source project, but its adoption has declined sharply since Bitbucket removed Mercurial support in 2020. The major code hosting platforms (GitHub, GitLab, Bitbucket) now exclusively support Git. Most development tools, CI systems, and deployment platforms like Vercel are built around Git. For new projects, Git is strongly recommended; for existing Mercurial projects, migration to Git is the practical path for using modern tooling like V0.
Can V0 export code to a Mercurial repository directly?
No — V0's code export is exclusively GitHub-based. When you use V0's Git panel, it creates commits in a connected GitHub repository and optionally opens a pull request. There is no Mercurial export option. To use V0 with a Mercurial-based project, you must first migrate the project to a GitHub repository.
Will the Mercurial-to-Git conversion preserve all branches and tags?
The fast-export tool converts Mercurial named branches and bookmarks to Git branches, and Mercurial tags to Git tags. The conversion is generally accurate, though Mercurial's branch model (named branches are permanent metadata on commits) differs from Git's branches (moveable pointers). Some Mercurial branch topologies — especially closed branches and anonymous heads — may need manual cleanup after conversion.
How long does migrating a large Mercurial repository to Git take?
Conversion speed depends on repository size and history length. A repository with a few thousand commits typically converts in under a minute. Repositories with tens of thousands of commits and many binary files may take 10-30 minutes. The network push to GitHub is usually fast for code-only repositories. The entire migration process (conversion, push, V0 connection, Vercel setup) typically takes 30-60 minutes for most repositories.
Can I keep using Mercurial locally while the team transitions to Git?
Yes — the hg-git extension for Mercurial allows bidirectional synchronization between a local Mercurial repository and a remote Git repository. You can continue using hg commands locally while the repository is hosted on GitHub. However, this adds complexity and the hg-git extension is not widely maintained. A clean cutover to Git is simpler and eliminates ongoing synchronization overhead.
Talk to an Expert
Our team has built 600+ apps. Get personalized help with your project.
Book a free consultation