Quantcast
Channel: Having trouble deleting a local branch even after checkout to another branch - Stack Overflow
Viewing all articles
Browse latest Browse all 7

Having trouble deleting a local branch even after checkout to another branch

$
0
0

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:

  1. Restarting my computer
  2. Reinstalling Git Bash
  3. Checkout to another branch and try git branch -d and git branch -D

Screenshot of error:git branch delete errorThe (virtualBDD) is my virtual environment. You can ignore that.


Viewing all articles
Browse latest Browse all 7

Latest Images

Trending Articles





Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>
<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596344.js" async> </script>