Reputation: 11
My project has 2 branches main
and feature1
. I merged them and then I tried to delete feature1
I thought the command was git checkout -d feature1
, but it wasn't and now it says HEAD is now at 71bgr8p (My latest commit message)
. And it shows that I'm in a branch ((71bgr8p...))
. When I type git branch
it says that the current branch I'm on is HEAD detached at refs/heads/feature1
How can I undo this?
Upvotes: 1
Views: 411
Reputation: 521249
You are currently in the detached HEAD state. The fix is easy, just checkout another branch, e.g. to return to the main
branch do:
git checkout main
As for deleting the feature1
branch, use the following:
git branch -d feature1 # to delete the local branch
git push -d origin feature 1 # to delete the remote branch
Upvotes: 2