After I added a remote end using git remote add origin2 xxxxxxx, I pushed some branches to origin2, and then deleted origin2, but now when I run git branch -a, I still see a lot of origin2 branches; please ask How to delete all the deleted remote branches?
Thank you everyone for your answers. I found the problem. The reason is because I deleted origin2 directly in the .git/config file. As a result, the branch of origin2 will still be listed when using git branch -a, and it cannot be deleted (git push origin2 :yourbranch will not work either)
The solution is :git remote add origin2 xxxxx
git push origin2 :yourbranch
git fetch -p
Use command
That’s it.