Skip to content

Copybara Documentation

Unofficial community docs for Google's code transformation tool

Copybara is Google’s tool for transforming and moving code between repositories. It enables workflows like:

  • Open sourcing internal code to public repositories
  • Importing contributions from external repos back to internal
  • Mirroring repositories with transformations
  • Syncing subsets of monorepos to standalone repositories
copy.bara.sky
core.workflow(
name = "export-to-github",
origin = git.origin(
url = "https://internal.git/repo",
ref = "main",
),
destination = git.github_pr_destination(
url = "https://github.com/org/public-repo",
destination_ref = "main",
),
origin_files = glob(["src/**"], exclude = ["**/internal/**"]),
transformations = [
core.move("src/", ""),
core.replace("internal.corp", "example.com"),
],
mode = "SQUASH",
)
FeatureBenefit
Declarative configDefine what you want, not how to do it
BidirectionalExport and import between any repositories
TransformationsModify paths, content, and metadata during sync
State trackingAutomatically tracks what’s been synced
PR-basedCreate PRs instead of direct pushes

Copybara is developed by Google and licensed under Apache License 2.0.