I need help deleting a local branch with Git
I’ve googled and there are several very long threads on this topic and none of them seem to help. I think I’m doing something wrong.
I have a branch called
Test_Branch. When I try to delete it using the recommend method, I get the following error:
Cannot delete branch ‘Test_Branch’ checked out at ‘[directory
Display latest tag in a commit with multiple tags How can I create a new remote branch by a commit with no changes? Is there a robust way of checking whether a prospective Git alias name is available? Anyone familiar with the git error “missing object 0000000000000000000000000000000000000000 for refs/heads/…”? gem.add_dependency Jeweler how do you format a git source? Find first commit specific to a branch
I get no other information besides that. I can blow away the remote branch easy but the local branch won’t go away.
2 Solutions collect form web for “I need help deleting a local branch with Git”
Switch to some other branch and delete
Test_Branch, as follows:
$ git checkout master $ git branch -d Test_Branch
If above command gives you error –
The branch 'Test_Branch' is not fully merged. If you are sure you want to delete it and still you want to delete it, then you can force delete it using
-D instead of
$ git branch -D Test_Branch
Test_Branch from remote as well, execute:
git push origin --delete Test_Branch
You probably have Test_Branch checked out, and you may not delete it while it is your current branch. Check out a different branch, and then try deleting Test_Branch.