Reputation: 10653
I looked around SO, but couldn't find any answer with the error I have.
I created a new branch but I forgot to do something before hand, so I need to delete the new branch I just created from my local machine.
The issue is, when I do git branch -d <branch_name>
I get this error:
Cannot delete the branch <branch_name> which you are currently working on.
But I'm not doing anything in it, I just want to delete it.
What are the steps to follow to delete a local branch and for the error not to come up again?
Many Thanks
Upvotes: 1
Views: 145
Reputation: 887215
You cannot delete the current branch from under your feet.
Before you can delete a branch, you must switch to a different branch:
git checkout other-branch
Upvotes: 6