> ## 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.

# pullUpstream()

> Force a pull from the configured upstream provider for a synced repository.

For repos that have been configured for Git Sync, you can force a pull with this command. It throws
an error in any situation that doesn't indicate a successful pull.

<CodeGroup>
  ```typescript TypeScript theme={null} theme={"theme":{"light":"github-light","dark":"min-dark"}}
  console.log(repo.listCommits());

  // Re-pull the repo to get the freshest commits
  await repo.pullUpstream();

  console.log(repo.listCommits());
  ```

  ```python Python theme={null} theme={"theme":{"light":"github-light","dark":"min-dark"}}
  print(await repo.list_commits())
  await repo.pull_upstream()
  print(await repo.list_commits())
  ```

  ```go Go theme={null} theme={"theme":{"light":"github-light","dark":"min-dark"}}
  // List commits from a branch
  // List commits before sync
  commits, err := repo.ListCommits(context.Background(), storage.ListCommitsOptions{})
  fmt.Println(commits.Commits)

  // Trigger a pull from the configured upstream
  err := repo.PullUpstream(context.Background(), storage.PullUpstreamOptions{})

  // List commits after sync
  updated, err := repo.ListCommits(context.Background(), storage.ListCommitsOptions{})
  fmt.Println(updated.Commits)
  ```
</CodeGroup>

> **Note** this method is useful when you want to trigger Git Sync on demand or when you manage
> GitHub webhook delivery yourself.

## Options

<ParamField path="ref" type="string">
  Branch or ref to pull from upstream. Defaults to the repo default branch.
</ParamField>

<ParamField path="ttl" type="string">
  Token TTL for this invocation in seconds.
</ParamField>

<ParamField path="refPolicies" type="object[]">
  Ordered per-ref policy rules (`{ pattern, ops? }`) embedded in the per-call JWT. First match wins. Python: `ref_policies`. Go: `RefPolicies` with type `storage.RefPolicyList`. See the [Branch Protection guide](/docs/guides/branch-protection).
</ParamField>

## Response

Returns `void`. Throws an error if the pull fails or if the repository is not configured for Git
Sync.
