Authoring
Authoring
Section titled “Authoring”Authoring controls how commit author information is handled during synchronization.
authoring.pass_thru
Section titled “authoring.pass_thru”Preserve original author when possible:
authoring = authoring.pass_thru( default = "Bot <bot@example.com>",)If the original author can be resolved, it’s preserved. Otherwise, the default is used.
Example
Section titled “Example”authoring = authoring.pass_thru( default = "Sync Bot <sync@example.com>",)# Alice commits → Alice's name preserved# Unknown author → Sync Bot usedauthoring.overwrite
Section titled “authoring.overwrite”Replace all authors with a single identity:
authoring = authoring.overwrite( "Sync Bot <sync@example.com>",)When to Use
Section titled “When to Use”- When all commits should appear from a bot account
- When original authors shouldn’t be exposed
- For automated sync workflows
authoring.allowed
Section titled “authoring.allowed”Only pass through specific authors:
authoring = authoring.allowed( default = "Bot <bot@example.com>", allowlist = [ "alice@example.com", "bob@example.com", ],)Example
Section titled “Example”authoring = authoring.allowed( default = "External Contributor <external@example.com>", allowlist = [ "maintainer1@org.com", "maintainer2@org.com", ],)# maintainer1@ commits → maintainer1@ preserved# random@ commits → External Contributor usedAuthor Format
Section titled “Author Format”Authors use Git’s standard format:
Name <email@example.com># Full formatauthoring = authoring.pass_thru("John Doe <john@example.com>")
# Minimalauthoring = authoring.pass_thru("bot <bot@example.com>")Common Patterns
Section titled “Common Patterns”Open Source Export
Section titled “Open Source Export”Preserve contributor attribution:
authoring = authoring.pass_thru( default = "Open Source Bot <oss-bot@company.com>",)Import External Contributions
Section titled “Import External Contributions”Allow external contributors:
authoring = authoring.allowed( default = "External Contribution <external@company.com>", allowlist = [ "*@company.com", # Internal emails pass through ],)Automated Sync
Section titled “Automated Sync”Use bot for all commits:
authoring = authoring.overwrite( "Copybara Sync <copybara@company.com>",)Map Internal to External
Section titled “Map Internal to External”Combine with metadata transform:
authoring = authoring.pass_thru("Bot <bot@example.com>")
transformations = [ metadata.map_author({ "alice@internal.corp": "alice@public.example.com", "bob@internal.corp": "bob@public.example.com", }),]Author Mapping
Section titled “Author Mapping”Use metadata.map_author for complex mappings:
# In transformationsmetadata.map_author({ "old-email@company.com": "new-email@company.com", "internal@corp.com": "external@example.com",})Multiple Authors (Squash)
Section titled “Multiple Authors (Squash)”In SQUASH mode, author of the last commit is used by default.
Use metadata to preserve author information:
mode = "SQUASH"
transformations = [ metadata.squash_notes( show_author = True, # Include authors in commit message ),]Commit message will include:
Sync from internal:- Alice <alice@example.com>: Fix bug- Bob <bob@example.com>: Add feature
GitOrigin-RevId: abc123Verification
Section titled “Verification”Check author configuration:
# Preview the syncjava -jar copybara.jar migrate copy.bara.sky workflow \ --folder-destination /tmp/output
# Check the commitcd /tmp/outputgit log --format="%an <%ae>"