question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Pull request from forked repo: "A branch with that name already exists."

See original GitHub issue

Describe the bug

After upgrading to 2.6.1 (apparently), re-selecting a PR branch from a forked repo fails with the error “A branch with that name already exists.”

Version & OS

  • GH Desktop: 2.6.1
  • MacOS: 10.14.6

Steps to reproduce the behavior

  1. Clone the storybook repo: https://github.com/storybookjs/storybook
  2. Select a PR from a forked branch, e.g. pr/13142
  3. Select a non-forked branch, e.g. next
  4. Re-select the PR from the forked branch in #2
  5. See error “A branch with that name already exists.”

Note that selecting a second PR from the same fork, e.g. pr/13429, will succeed after performing these steps. And then selecting another branch and re-selecting pr/13429 will fail with the same error.

Expected behavior

I expect to be able to freely switch between branches, including PRs from forked repos.

Actual behavior

Selecting a branch on a forked repo fails the second time around.

Logs

2020-12-16T02:11:24.810Z - info: [ui] Executing fetch: git -c credential.helper= -c protocol.version=2 fetch --progress --prune github-desktop-BarryThePenguin (took 2.222s)
2020-12-16T02:11:25.178Z - error: [ui] `git branch pr/13429 github-desktop-BarryThePenguin/update-ember-cli` exited with an unexpected code: 128.
stderr:
fatal: A branch named 'pr/13429' already exists.

(The error was parsed as 26: A branch with that name already exists.)

Additional context

  • Checking out PRs from forked repos is a regular part of my workflow, and the problem seems to have been introduced very recently, probably in v2.6.1.
  • Manually deleting the branch locally on the command line git branch -d pr/13429 is a temporary workaround.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

22reactions
jlund24commented, Jul 3, 2021

for those with this issue, here’s how I resolved it on GitHub Desktop:

  • in your forked branch (e.g. “master”), select History in the left panel
  • click “select Branch to Compare…”
  • select “upstream/master” or your comparable branch that has a conflict to be resolved
  • this will bring up a dialog for actually resolving the conflicts
4reactions
fnehmercommented, Jun 13, 2021

Facing the bug in Version 2.8.6 (x64) Windows aswell

Read more comments on GitHub >

github_iconTop Results From Across the Web

Github can't create a Fork from a branch, repository already ...
Forking a repo with a different name within the same org is not available yet, but it will be added very soon it...
Read more >
Creating merge requests - GitLab Docs
On the top bar, select Main menu > Projects and find your project. · On the left menu, select Repository > Branches. ·...
Read more >
Forking a GitHub Repository and Using Pull Requests
In Github, navigate to the repository to be forked and select “Fork” on the upper right. Select your own user name when prompted....
Read more >
Remote Origin Already Exists Error: How To Fix It | CloudBees
Go to your local repository and remove the existing origin remote. Add the new online repository as the correct origin remote. Push your...
Read more >
How to Sync and Update a Forked Repository - Section.io
Your branch content is on your remote GitHub repository, and you need to create a pull request to the origin repository to contribute...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found