Lovable projects use built-in version history for undo/revert and optional GitHub integration for full Git workflows. Connect GitHub via Settings → Connectors → GitHub for two-way sync on the main branch. Enable branch switching in Settings → Account → Labs. Never rename, move, or delete a connected GitHub repository — it permanently breaks the sync. For viewing commit history and reverting changes, use Lovable's version history panel in the chat sidebar.
Why version control needs specific setup in Lovable projects
Lovable has its own built-in version history system that tracks every change the AI makes to your project. You can scroll through previous versions in the chat panel, preview any version, and restore to it. For most users, this is sufficient version control. However, for more advanced workflows — collaborating with developers, deploying to Vercel or Netlify, or maintaining a backup outside Lovable — you need GitHub integration. Lovable provides two-way sync with GitHub: changes in Lovable push to GitHub, and changes in GitHub pull back into Lovable. This sync only works on the default branch (main). The most critical rule is to never rename, move, or delete the GitHub repository after connecting it. This breaks the sync permanently and there is no automated recovery. If you need to change the repository, disconnect from Lovable first, make the change on GitHub, then reconnect (which creates a new repository). Branch switching is available as a Labs feature for users who need to work on features in isolation before merging to main.
- GitHub repository renamed or transferred after connecting — permanently breaks sync
- Merge conflicts between Lovable changes and GitHub changes on the same files
- Branch switching not enabled — changes only sync on the main branch by default
- Stale OAuth token after organization rename — Lovable cannot find the repository
- Multiple team members editing the same project simultaneously, creating conflicting versions
Error messages you might see
GitHub commit cards not rendering in the Lovable UIA known platform issue where GitHub sync status is not visible in the editor. Check status.lovable.dev for ongoing incidents. Your code is likely still syncing even if the UI does not show commit cards.
Merge conflicts: Lovable can't deploy if GitHub reports conflicts in your filesBoth Lovable and a GitHub user modified the same file. Resolve the conflict manually in GitHub by editing the conflicting file, then Lovable will pull the resolved code on the next sync.
Cannot find or access the repositoryThe GitHub repository was renamed, transferred, or the Lovable GitHub App was uninstalled. Reconnect by going to Settings → Connectors → GitHub. If reconnecting fails, disconnect and create a new repository connection.
Before you start
- A Lovable project (version history works on all plans without any setup)
- A GitHub account for Git integration (go to Settings → Connectors → GitHub to connect)
- Workspace admin or owner role in Lovable to manage GitHub connections
- The Lovable GitHub App installed on your GitHub account or organization
How to fix it
Connect your Lovable project to GitHub
GitHub integration enables two-way code sync, external backups, and deployment pipelines
Connect your Lovable project to GitHub
GitHub integration enables two-way code sync, external backups, and deployment pipelines
Go to Settings → Connectors → GitHub and click Connect GitHub. Sign in to your GitHub account and authorize Lovable. Next, click Connect project and choose the GitHub organization or personal account where you want the repository. Click Add organizations if your organization is not listed, then Install & Authorize. Finally, click Transfer anyway to confirm. Lovable creates a new GitHub repository and starts syncing your code. The default branch (main) is synced in both directions.
Expected result: A new GitHub repository appears in your GitHub account with all your Lovable project code. Future changes in Lovable appear as commits in GitHub.
Enable branch switching for feature development
Working on branches lets you develop features in isolation without affecting the main codebase
Enable branch switching for feature development
Working on branches lets you develop features in isolation without affecting the main codebase
Go to Settings → Account → Labs and enable the branch switching feature. Once enabled, you can create new branches from the Lovable editor to work on features without modifying the main branch. Changes on feature branches are not synced to the main branch until you merge them in GitHub. This is useful for testing experimental changes before committing them to your production code.
Expected result: A branch selector appears in the Lovable editor. You can create branches, switch between them, and merge via GitHub when ready.
Use Lovable's version history to revert changes
Version history lets you undo AI changes without needing Git knowledge
Use Lovable's version history to revert changes
Version history lets you undo AI changes without needing Git knowledge
Scroll up in the chat panel or click the View History icon to see all previous versions of your project. Each version corresponds to an AI change or a GitHub sync. Click on any version to preview it in the editor. If you want to go back to that version, click Restore. This is especially useful when the AI makes a change that breaks something — you can quickly revert to the last working state without using Git commands.
Expected result: The project reverts to the selected version. The preview shows the app in its previous state. All subsequent changes are preserved in history if you need to go forward again.
Resolve merge conflicts between Lovable and GitHub
When both Lovable and a developer modify the same file, Git cannot automatically merge the changes
Resolve merge conflicts between Lovable and GitHub
When both Lovable and a developer modify the same file, Git cannot automatically merge the changes
If a merge conflict occurs, Lovable will not be able to sync until the conflict is resolved. Go to your GitHub repository and find the conflicting files (GitHub marks them with conflict indicators). Edit the files to resolve the conflicts — choose the correct version of each changed section. Commit the resolved files to the main branch. Lovable will detect the new commit and pull the resolved code. If merge conflicts involve multiple generated components with intertwined changes, RapidDev's engineers have resolved this pattern across 600+ Lovable projects.
<<<<<<< HEAD// Lovable's version of the componentconst Header = () => <h1>Welcome Home</h1>;=======// Developer's version from GitHubconst Header = () => <h1>Welcome to Our App</h1>;>>>>>>> main// Resolved: kept the developer's version with Lovable's stylingconst Header = () => <h1 className="text-3xl font-bold">Welcome to Our App</h1>;Expected result: The conflict is resolved in GitHub. Lovable syncs the resolved code and the editor shows the correct merged version.
Complete code example
1# Project Agent Instructions23## Version Control Rules45- Do NOT modify files in the /supabase directory without explicit permission6- Do NOT change the project's routing structure in src/App.tsx without approval7- Do NOT remove or rename existing component files — create new ones instead8- When adding features, create new files rather than heavily modifying existing ones910## Code Style1112- Use TypeScript strict mode for all new files13- Follow the existing naming convention: PascalCase for components, camelCase for utilities14- Import from @/ alias (maps to src/) instead of relative paths15- Use shadcn/ui components from @/components/ui/ for all UI elements1617## Protected Files (do not edit)1819- src/integrations/supabase/client.ts20- src/integrations/supabase/types.ts21- vite.config.ts22- tailwind.config.ts2324## Deployment Notes2526- Build command: npm run build27- Output directory: dist/28- Node version: 2229- Environment variables use VITE_ prefix for client-side accessBest practices to prevent this
- Never rename, move, or delete a GitHub repository that is connected to Lovable — it breaks sync permanently
- Use Lovable's built-in version history for quick undo/revert operations — it is faster than Git for simple rollbacks
- Enable branch switching in Settings → Account → Labs to develop features without affecting the main branch
- Commit frequently in Lovable by making small, focused changes rather than large multi-feature prompts
- Resolve merge conflicts in GitHub rather than trying to fix them from the Lovable editor
- Add an AGENTS.md file to your project root with rules about which files should not be modified by the AI
- If you disconnect GitHub integration, the repository remains on GitHub but sync stops — you can reconnect later to a new repository
- Before major refactors, duplicate the project as a backup in case the version history is not granular enough
Still stuck?
Copy one of these prompts to get a personalized, step-by-step explanation.
I'm using Lovable (lovable.dev) with GitHub integration and I'm having sync issues. My project uses Vite + React + TypeScript. Here is my situation: - GitHub repo: [your repo name] - Branch: main - Problem: [describe what's happening — sync stopped, merge conflict, commits not appearing] Please: 1. Help me diagnose whether this is a Lovable platform issue or a Git configuration issue 2. If it's a merge conflict, show me how to resolve it in GitHub 3. Explain the correct workflow for making changes in both Lovable and GitHub without conflicts 4. Tell me if I need to disconnect and reconnect the GitHub integration
I need to review the current state of my project's version history. Please check if there are any uncommitted changes, verify that the GitHub integration is working by listing recent changes, and confirm that all files in the project are consistent with the latest version. Also check if there are any import errors or missing files that might have been lost during a version revert.
Frequently asked questions
How does Lovable version control work?
Lovable has built-in version history that tracks every AI change. You can preview any previous version and restore to it from the chat panel. For full Git workflows, connect to GitHub via Settings → Connectors → GitHub for two-way sync on the main branch.
Can I use branches in Lovable?
Yes, branch switching is available as a Labs feature. Enable it in Settings → Account → Labs. Once enabled, you can create and switch between branches in the Lovable editor. Changes on non-main branches are not synced until merged in GitHub.
What happens if I rename my connected GitHub repository?
Renaming, moving, or deleting a connected GitHub repository permanently breaks the sync with Lovable. There is no automated recovery. If you need to make such changes, disconnect the repository in Lovable first, then reconnect after the change.
How do I resolve merge conflicts between Lovable and GitHub?
Go to your GitHub repository and find the conflicting files. Edit them to resolve the conflicts by choosing the correct version of each section. Commit the resolved files to main. Lovable will detect the commit and pull the resolved code.
Can I import an existing GitHub repo into Lovable?
No. Lovable only supports exporting from Lovable to GitHub, not importing. You can create a new Lovable project and copy code from your existing repo using Dev Mode or by prompting the AI with the file contents.
Is GitHub integration required to use Lovable?
No. Lovable works independently with its own version history. GitHub integration is optional and useful for external backups, deploying to other hosting platforms, collaborating with developers, or working in external code editors.
What if I can't fix version control issues myself?
Git sync issues between Lovable and GitHub — especially merge conflicts across multiple auto-generated files — can be complex to resolve. RapidDev's engineers have handled Git integration problems across 600+ Lovable projects and can restore your sync safely.
Talk to an Expert
Our team has built 600+ apps. Get personalized help with your issue.
Book a free consultation