Ton
Ton

Reputation: 83

How to delete remote branch on phpstorm after I delete on gitlab?

How to delete remote branch on phpstorm after I delete on gitlab

After deleting that branch on GitLab, I cannot select the same branch in my PhpStorm-managed local repo without seeing the error message:

Failed to delete remote branch origin/branch1

unable to delete 'branch1': remote ref does not exist failed to push
some refs to 'http://[email protected]/owner/projectname.git'

How can I avoid that error message?

Upvotes: 7

Views: 3660

Answers (1)

VonC
VonC

Reputation: 1324537

This is seen when a remote repo has no longer a specific branch, but an IntelliJ GUI like PhpStorm still reference it as a remote tracking branch.
See IDEA-96402 (Dec. 2012, not yet closed):

Remote branches on a project hosted on bitbucket.org don't exist anymore, but are still listed on my phpstorm installation.

  1. Bitbucket does not list the branch anymore
  2. When I select the branch to delete from within PHPSTORM, i receive the message
Failed to delete remote branch origin/hotfix/bug-121: null: NON_EXISTING

The workaround is for now a manual one:

  1. You can call git remote prune origin in the command line.
  2. If you call Update Project to pull from the remote, it will automatically prune all obsolete references.

The ticket adds:

Note that if you delete a remote branch from the IDE or from the command line, the reference is deleted as well.
This request is about deleting remote reference on the branch which was removed from the remote via some other way, not from this repository.

Upvotes: 6

Related Questions