Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Accidentally created branch with name origin/master

Tags:

git

In a fit of unbelievable stupidity I accidentally ran

git checkout -b origin/master

And now have a branch named origin/master which ruins everything. Is it safe to just run

git -D origin/master?

I tried looking in the config for the branch but its not defined there. Yet when I run git branch I see it.

):

like image 372
John Montague Avatar asked Feb 25 '12 02:02

John Montague


People also ask

Can I delete and recreate master branch git?

Can the master branch be deleted? The master branch is just a type of branch in the repository, which is also the default branch by default. But, as a rule in Git, default branches cannot be deleted. So, to delete the master branch first, the user has to change the default branch.


1 Answers

git branch -D origin/master will delete your local origin/master branch.

This will not delete your origin's (remote) master branch. Deleting your remote branches would be either:

(git 1.7.0)

git push origin --delete branch

or

git push origin :branch

like image 143
triad Avatar answered Nov 14 '22 10:11

triad