How to forcefully delete a remote branch in GitHub?

后端 未结 2 1593
北恋
北恋 2021-02-07 11:13

I have 2 remote branches :

 - pending-issues-in-project
 - new-issues-in-project

I tried to delete pending-issues-in-project lik

2条回答
  •  暖寄归人
    2021-02-07 11:56

    The branch you're seeing is what's called a remote [tracking] branch. It's in your local repository, and it represents the last place you saw that branch in the remote repository. Git uses branches like this so that you don't have to talk to the remote repository every single time you want to deal with it; you just update/fetch once, the remote racking branch is updated, and you can work from that. In your case, the branch in the remote repository is long since deleted; you just need to remove the copy in your local repository.

    There are two main ways to delete it:

    • git branch -d -r origin/pending-issues-in-project removes just that branch; and
    • git remote prune origin deletes all such stale remote branches. You can also update at the same time: git remote update --prune origin

提交回复
热议问题