Copybara

Google's internal tool, open-sourced, for transforming and moving code between repositories — keeping a confidential and public repo in sync, importing external contributions into an authoritative repo, or migrating code once.

3.6Kstars
331forks
Apache License 2.0
Java

Copybara is the tool Google uses internally to solve a problem many organizations face at smaller scale: source code that needs to exist in more than one repository, kept in sync through transformation rather than manual copy-pasting. One repository is designated authoritative (the single source of truth), but Copybara allows contributions to flow into any of the repositories and transforms/moves changes between them as needed.

Common patterns include importing sections of code from a confidential internal repository into a public open-source repository (or the reverse), and importing changes made by contributors in a non-authoritative repository (like a public GitHub mirror) back into the authoritative one, resolving conflicts the same way an out-of-date change would be handled within a single repo. It can also be used for one-time repository migrations rather than only repetitive sync workflows.

Apache-2.0 licensed and written in Java, Copybara reflects years of internal production use at Google before being open-sourced, making it a mature, battle-tested tool for a specific but common organizational need: maintaining code across a public/private repository split.

What You Get

  • Automated transformation and movement of code changes between two or more repositories
  • A defined authoritative-repository model so there’s always a single source of truth, even with multi-repo contributions
  • Conflict resolution for out-of-sync changes handled the same way as normal same-repo merge conflicts
  • Support for both repetitive sync workflows and one-time repository migrations

Common Use Cases

  • Keeping a confidential internal repository and a public open-source repository in sync automatically
  • Importing contributions made in a public repository (e.g., GitHub PRs) into an authoritative internal repository
  • Migrating a codebase from one repository to another as a one-time transformation rather than a manual copy
  • Maintaining code that legitimately needs to exist in multiple places with different visibility or access levels

Under The Hood

Architecture Copybara’s design centers on the authoritative-repository model: one repo is designated the source of truth, and the tool defines transformation and movement rules for syncing changes to and from other repositories, treating out-of-sync changes from non-authoritative sources the same way it would treat a normal merge conflict within one repo. This lets contributions flow in from public mirrors while keeping the internal repository’s history and review process authoritative.

Tech Stack Java, distributed as a standalone tool for defining and running repository transformation workflows, configured to work with Git and other version control systems as source and destination repositories.

Code Quality Very active, consistently maintained commit history and strong project maturity signals (per health metrics) reflect years of internal production hardening at Google before and after open-sourcing — a meaningfully different maturity profile than most community-originated dev tools.

What Makes It Unique Most code-sync tools handle a single migration or a simple mirror; Copybara specifically models the ongoing, bidirectional-but-authoritative relationship between a confidential and public repository (or any multi-repo split), a pattern many large organizations need but few tools address directly, refined through Google’s own internal use at scale.

Self-Hosting

Licensing Model Apache-2.0 licensed — fully open source with no license key.

Self-Hosting Restrictions Not applicable; it’s a self-run CLI tool operating on your own repositories.

License Key Required No.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack

No spam. Unsubscribe anytime.

Join 750+ subscribers
No spam. Unsubscribe anytime.

Search