Git failed to delete the branch, prompting: error: Cannot delete branch... The problem is solved

a question source

      There are many branches in the local code warehouse. As the project continues to iterate, such branches become more and more. So I want to delete such a branch. When deleting a branch, an error is reported: error: Cannot delete branch '' checked out at '/Users/GoProject/src/code, and the corresponding prompt is as follows:

insert image description here

Two problem solving

      The first thing to explain is that I switched to the master branch and then deleted this branch (that is, I am not on the current branch, delete the current branch). In addition, to delete the branch locally, it is generally to execute the command: git branch -Dand git branch -d, in most cases, it will succeed! But strangely enough, it didn't work out this time.
      After checking the status of this branch, I found that the reason for this problem was that I had performed code rebaseoperations on this branch at the beginning, but there was a conflict, and the conflict was not resolved, so I left it like this

Guess you like

Origin blog.csdn.net/whq19890827/article/details/130836831
Recommended