bobbay
bobbay

Reputation: 493

Created a branch called HEAD by accident

I created a local branch in git called test1234 and pushed it to origin through Eclipse. But I did something really wrong because I got an email, "superbobbay pushed new branch HEAD" when I was expecting "superbobbay pushed new branch test1234"

git branch -r shows origin/HEAD->origin/master

cat .git/HEAD just returns a commit string "8da516...."

Is there a way to revert this? I can't seem to fetch/rebase anymore.

Upvotes: 0

Views: 120

Answers (2)

quetzalcoatl
quetzalcoatl

Reputation: 33516

Go to .git directory in your local working copy, go to the refs subdir and find a file called like your branch - HEAD - and delete it.

Mind that I' writing about refs subdir. Not logs not root .git.

Upvotes: 2

Abhishek Ranjan
Abhishek Ranjan

Reputation: 497

since you've already pushed to origin, you can goto gitlab GUI -> Repository settings & delete the branch from there.

Then you can simply re-clone the repo, or delete the branch from your local repo to remove its existence completely.

Kudos !

Upvotes: 1

Related Questions