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
location]’.

  • 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.

  • How to configure git encoding for German Umlaute on Ubuntu and Windows?
  • Every git commit / git stash asks me for a password
  • Pip install -r requirements.txt on Git Pull?
  • Importing git project into workspace without using egit
  • How do I avoid making commits where a full file is shown as modified when there are only small changes in the file?
  • Git: finding largest files of a large pack file
  • 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 -d, as:

    $ git branch -D Test_Branch
    

    To delete 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.

    Git Baby is a git and github fan, let's start git clone.