# Avoid fork PR head branch collisions when creating worktrees · gitcafe/t3code

[View on GitCafe](https://git.cafe/gitcafe/t3code/commit/f7570712a741136999a77d5a8f6490a8c7d9e249)

Repository: [gitcafe/t3code](https://git.cafe/gitcafe/t3code)

Visibility: public

Requested revision: f7570712a741136999a77d5a8f6490a8c7d9e249

Requested commit: f7570712a741136999a77d5a8f6490a8c7d9e249

Commit: f7570712a741136999a77d5a8f6490a8c7d9e249

Tree: 3117fba6350db3eaaddea9e5842378255dc48d1c

Author: Julius Marminge

Committer: Julius Marminge

## Message

```
Avoid fork PR head branch collisions when creating worktrees

- create a unique local branch name for cross-repo PR worktrees (`pr/<number>-<head>`)
- fetch/set upstream against that local branch instead of overwriting local `main`
- add regression tests for fork PRs where head branch is `main`

```

## Parents

- [2847655a1a1f8f45d64224ee45b9262a1fc14dfc](https://git.cafe/gitcafe/t3code/commit/2847655a1a1f8f45d64224ee45b9262a1fc14dfc?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/t3code/tree/f7570712a741136999a77d5a8f6490a8c7d9e249?format=markdown)
