15

Ok, I've created an origin/origin/master branch and I've pushed it. I'm scared to do some remove operations. Whan can I do? Is it safe to run a remove operation?

interlude
  • 843
  • 8
  • 29
  • 1
    Since "origin/master" branch on a remote can be protected by service provider I don't think this is a duplicate question. – interlude Jan 17 '18 at 11:25

1 Answers1

10

Don't worry, you can always go back with git. Make sure you have your master branch locally, then try this one:

git push origin :origin/master

It will delete origin/master branch on a remote "origin".

If you want to be supersafe, rename your remote from "origin" to "temp", then do:

git push temp :origin/master

Adam Adamaszek
  • 3,914
  • 1
  • 19
  • 24
  • If your remote is a Github repository, you might see a message like this: `To github.com:username/your-repo.git ! [remote rejected] origin/master (refusing to delete the current branch: refs/heads/origin/master) error: failed to push some refs to 'git@github.com:username/your-repo.git' ` This is because the default branch is set to `origin/master` instead of `master`, and it is protected. Change the default branch under the "Settings" tab > "Branches". – Jake Wisse Jun 08 '17 at 21:23