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?
Pushing to delete remote branches also removes remote-tracking branches. Note that deleting the remote branch X from the command line using a git push will also remove the local remote-tracking branch origin/X , so it is not necessary to prune the obsolete remote-tracking branch with git fetch --prune or git fetch -p .
To delete a remote branch, you can't use the git branch command. Instead, use the git push command with --delete flag, followed by the name of the branch you want to delete. You also need to specify the remote name ( origin in this case) after git push .
How to Delete a Branch Remotely. You'll often need to delete a branch not only locally but also remotely. To do that, you use the following command: git push <remote_name> --delete <branch_name>.
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.
- Bitbucket does not list the branch anymore
- 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:
- You can call
git remote prune origin
in the command line.- 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With