> ## Documentation Index
> Fetch the complete documentation index at: https://code.storage/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# promoteEphemeralBranch()

> Promote an ephemeral branch to a persistent branch, optionally renaming it in the process.

<CodeGroup>
  ```typescript TypeScript theme={null} theme={"theme":{"light":"github-light","dark":"min-dark"}}
  // Promote in place (same branch name)
  const result = await repo.promoteEphemeralBranch({
    baseBranch: 'preview/pr-123',
  });
  console.log(result.targetBranch); // 'preview/pr-123'

  // Or promote to a new name
  const renamed = await repo.promoteEphemeralBranch({
    baseBranch: 'preview/pr-123',
    targetBranch: 'feature/awesome-change',
  });
  console.log(renamed.targetBranch); // 'feature/awesome-change'
  ```

  ```python Python theme={null} theme={"theme":{"light":"github-light","dark":"min-dark"}}
  # Promote in place (same branch name)
  result = await repo.promote_ephemeral_branch(base_branch="preview/pr-123")
  print(result["target_branch"])  # "preview/pr-123"

  # Or promote to a new name
  result = await repo.promote_ephemeral_branch(
      base_branch="preview/pr-123",
      target_branch="feature/awesome-change",
  )
  print(result["target_branch"])  # "feature/awesome-change"
  ```

  ```go Go theme={null} theme={"theme":{"light":"github-light","dark":"min-dark"}}
  // Promote in place (same branch name)
  result, err := repo.PromoteEphemeralBranch(context.Background(), storage.PromoteEphemeralBranchOptions{
  	BaseBranch: "preview/pr-123",
  })
  fmt.Println(result.TargetBranch)

  // Or promote to a new name
  renamed, err := repo.PromoteEphemeralBranch(context.Background(), storage.PromoteEphemeralBranchOptions{
  	BaseBranch:   "preview/pr-123",
  	TargetBranch: "feature/awesome-change",
  })
  fmt.Println(renamed.TargetBranch)
  ```
</CodeGroup>

Moves a branch from the ephemeral namespace into the default namespace. Once promoted, the branch is
treated like any other persistent branch and will be included in Git Sync if configured.

## Options

<ParamField path="baseBranch" type="string" required>
  The ephemeral branch to promote.
</ParamField>

<ParamField path="targetBranch" type="string">
  Destination branch name in the default namespace. Defaults to `baseBranch` when omitted.
</ParamField>

## Response

<ResponseField name="targetBranch" type="string">
  The name of the promoted branch in the default namespace.
</ResponseField>
