Search code examples
gitgit-branchgit-merge-conflict

Git: delete remote conflict branch


I'd like to remove a branch that was created during a conflict on remote:

git branch -r

origin/master
origin/master_SPITFIREMKV_Jun-26-221715-2020_Conflict

I tried variations of

git push origin --delete master_SPITFIREMKV_Jun-26-221715-2020_Conflict

But it always returns the following error:

error: unable to delete 'master_SPITFIREMKV_Jun-26-221715-2020_Conflict': remote ref does not exist
error: failed to push some refs to '...'

Thanks a lot for your help!


Solution

  • The branch you wanted to delete is already deleted on the remote side, but the remote tracking branch still exists. To fix that, you can run git fetch --prune origin, which will remove local tracking branches for the remote that no longer exist upstream.