Git Delete local branch error occurred

Source: Internet
Author: User
Tags using git
git Delete local branch error occurred

Deleting a local branch often occurs in the following ways: error:the branch ' testing ' is not fully merged.

With git branch-d testing, an error occurs because the deleted branch contains work that has not yet been merged. The workaround is to forcibly delete it, denoted by the parameter "-D". So the delete command is git branch-d testing. error:cannnot Delete Branch ' testing ' checked out at ' d:/practice/project '

The cause of the error is most likely that you are on the branch, and then trying to delete the branch is not allowed. It is the same as deleting open files under Windows System. The workaround is to simply switch branches to any other branch and then delete them. For example, remove the "testing" branch and you can do so.

$ git checkout master
$ git branch-d testing

git checkout Master This command has done two things. One is to point head back to the master branch, and the second is to restore the working directory to the snapshot content pointed to by the Master branch. The Master branch is not a special Branch, and it is completely indistinguishable from other branches. Each repository has a master branch because the GIT init command creates it by default, and most people rarely change it. error:cannot Delete the branch ' testing ' which you is currently on

The reason for this error is the same as the second one above, which is currently on the branch that you want to delete. So the solution is the same as the second. error:branch ' testing ' not found

As prompted, this error occurs because the testing branch is not found, but you can see them by using git branch-a commands.
from the cause of the hint is not found testing branch, so for the sake of accuracy, we can find from the./git/refs/heads/folder, see if there is testing, if any, delete this file. Look again at the. git/packed-refs file, search for testing, and if so, delete that line.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.