I'm trying to delete my local branch and tried most of the solutions I found on here which is to checkout to another branch and then run git branch -D (or -d) <my_branch>
. I tried that but I am still getting the same error that states "Cannot delete branch 'my_branch' checked out at 'my_path'
How I got myself in this situation: I branched off of my develop branch by doing git worktree add -b branch_name ../project_name develop
. Then I realized I wanted to change my branch name so I deleted the entire directory first by using rm- rf
. Now my_path is pointing to a deleted directory so I'm not sure what to do now. Help will be appreciated. I'm running on Windows 7 using Git Bash
Things I have tried:
- Restarting my computer
- Reinstalling Git Bash
- Checkout to another branch and try
git branch -d
andgit branch -D
Screenshot of error:
The (virtualBDD) is my virtual environment. You can ignore that.