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

# repo.pullUpstream()

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

> [!WARNING]
>
> This page documents the earlier Code Storage SDKs: `@pierre/storage`, `pierre-storage`, and
> `code-storage-go`. New code uses the [Pierre SDK](https://code.storage/docs/sdks.md). To move code to the new SDK, use the
> [`pierre-migrate`
> skill](https://github.com/pierrecomputer/skills/tree/main/skills/pierre-migrate).

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.

```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)
```

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

## Options

**ref** `string` *deprecated*

Deprecated. Omit it. The option has no effect: a pull syncs every branch and tag of the upstream.

**ttl** `string`

Token TTL for this invocation in seconds.

**refPolicies** `object[]`

Ordered ref policy rules (`{ pattern, ops? }`) in the JWT for this call. Code Storage uses the first rule that matches the target ref. Python: `ref_policies`. Go: `RefPolicies` with type `storage.RefPolicyList`. See [Ref Policies](https://code.storage/docs/repos/ref-policies.md).

## Response

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


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.