A founder's Lovable prototype is being handed to an in-house team that requires reviewed pull requests on main — how should Lovable's two-way Git sync be set up, and what does the repository not carry?
answer
- export only, never import
- one synced branch at a time
- a fallback branch on rejected pushes
- never rewrite synced history
- data, secrets and deploys stay behind
basics
~20 sLet Git sync create a repository the team owns, keep Lovable on its own feature branch merged through reviewed pull requests, and never rewrite the synced branch. The repository holds code and migration files, not data, secrets or deployments.
solid answer
~50 sGit sync connects a Lovable project to GitHub, GitLab or Bitbucket and **always creates a new repository** — it is export-only, so an existing repo cannot be imported. Sync is automatic and two-way, but Lovable edits **one branch at a time**. With a protected `main`, switch Lovable to a feature branch of its own and merge its work through the team's review; if a push is rejected, Lovable puts its work on a `lovable-sync` branch instead. Nobody should force-push, rebase or squash the synced branch. On GitHub, commits come from the `lovable-dev[bot]` app identity, co-attributed to the member when possible. The repository carries code and migration files, but not database data, secrets or Lovable-managed credentials; synced commits do not run migrations or deploy edge functions, and a push never publishes. Lovable's terms say the code is yours, subject to third-party rights such as open-source licences.
go deeper
Remember that Git sync creates a new repository, syncs both ways on one branch, and that pushing never publishes the app.
Explain the lovable-sync fallback for rejected or diverged pushes, the bot commit identity, and why migrations and edge functions need a separate step after sync.
Set up the hand-over: Lovable on its own branch through reviewed pull requests, no history rewrites, and a plan for data, secrets and the shared backend behind the repository's .env.
Decide how long the team keeps building in Lovable versus moving fully to its own tooling, weighing managed credentials and hosting against ownership of the whole pipeline.
## What the team actually receives When a founder hands a Lovable prototype to engineers, the first question is ownership. Lovable's ownership page says the apps, code and content you create are **yours**, subject to third-party rights such as open-source licences, and you may modify, use commercially and host them anywhere. The editor and agent are a managed service that cannot be self-hosted, but the generated app can run anywhere. **Git sync** is how the code reaches a repository the team controls; it is available on all plans, while a one-off `.zip` download is a paid-plan feature. ## How Lovable's Git sync works - **Two layers**: a workspace owner or admin creates a **workspace connection** (on GitHub, via the Lovable GitHub App); a project is then linked to **one repository** under it. - **Export only**: linking always **creates a new repository**. You cannot import an existing repository, and reconnecting after a disconnect creates yet another new repository. - **Two-way and automatic**: Lovable commits and pushes its edits; commits pushed to the synced branch appear in the Lovable project and go through the same checks, including the dependency audit. - **One branch at a time**: Lovable edits and syncs only the branch selected in **Project settings → Git**, usually `main`. Other branches stay invisible to Lovable until merged. ## A branch strategy that fits a pull-request team 1. Connect the project and let Lovable create the repository in the team's organization. 2. Switch Lovable to a **feature branch of its own** with **Create branch** in the branch picker — it branches from the *currently active* branch, so switch to `main` first. 3. Developers work on their own feature branches locally; nothing reaches Lovable until merged into its synced branch. 4. Merge Lovable's branch into `main` through the normal reviewed pull request. If Lovable stays on a protected `main`, the provider rejects its pushes and Lovable pushes to a branch called **`lovable-sync`** instead, with a notice to merge it. If someone has already added commits to `lovable-sync`, Lovable uses `lovable-sync-<timestamp>`. The same fallback applies when the sync status card reports **Lovable and GitHub have diverged**; the next sync from GitHub then replaces Lovable's copy of the branch. **Never force-push, rebase or squash commits already on the synced branch.** Lovable keeps its own copy of that branch; rewriting history makes the next sync replace Lovable's copy, and edits made only in Lovable can be lost. To undo, add a reverting commit. ## Who wrote each commit Commits Lovable pushes to GitHub are authored by the app identity **`lovable-dev[bot]`** (raw `git log` may show `gpt-engineer-app[bot]`, the account's earlier name) and co-attributed to the member who triggered them when that member has connected a GitHub account. On Business and Enterprise plans an admin can enable **Include member email addresses in commits**, off by default, which adds an `X-Lovable-Author-Email` line; it is discouraged for public repositories because history cannot be rewritten afterwards. ## What the repository does not carry | Not in the repository | Consequence for the team | |---|---| | Database data | Export data separately; migrations under `supabase/migrations/` record structure only | | Secrets stored in Lovable | Server code that reads them needs the values wherever it runs | | Lovable-managed connector and AI credentials | Cannot be copied out; in TanStack Start apps those calls fail when run locally | | Deployment | A push updates the preview but **never publishes**; only publishing from Lovable changes the live site | Two traps follow. Synced commits **do not run new migration files or deploy changed edge functions** — ask Lovable in the chat to deploy them, or run SQL yourself. And the repository's `.env` (for example `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_KEY`) points at the **same backend as the published app**, so a local run writes real data; a Git branch is not a separate database. Never put a service role key in a `VITE_` variable, which ships to the browser. ## Keeping hand-written code safe Lovable treats code the team writes the same as code it generated and may change it later. Record constraints in project knowledge and cover the behaviour with tests. How the team reviews the generated code, and how licence provenance is judged, are subjects of their own; the Lovable-specific part is the branch discipline and knowing what sync leaves behind.
- A developer rebased the synced branch of a Lovable project and force-pushed it. What is at risk?Lovable keeps its own copy of the synced branch. Rewriting that branch's history makes the next sync replace Lovable's copy with the rewritten one, so edits that existed only in Lovable can be lost. The safe way to undo a change on the synced branch is a new commit that reverts it.
- A developer merges a new migration file and a changed edge function into a Lovable project's synced branch. Are they live?No. Lovable syncs the files but does not run new migration files or deploy changed edge functions from synced commits. Ask Lovable in the project chat to deploy the function, and apply the schema change by asking Lovable or running the SQL yourself. Publishing is also separate: a push never changes the live site.
- Can the team point Lovable at the repository they already have?No. Lovable's Git sync is export-only: linking a project always creates a new repository, and an existing repository cannot be imported. Disconnecting leaves the repository intact, but reconnecting later creates another new repository rather than re-linking the old one.
- Lovable can import the team's existing repository
- Pushing to the synced branch redeploys the live app
- Lovable syncs every branch in the repository
- Squashing the synced branch's history is harmless cleanup
- Cloning the repository gives developers a separate test database
- Synced migration files run automatically on the backend