0

I want to change my master branch to release, both locally and remote (on github). I know there is a question exactly for this, here an stackoverflow. My case is different, I've used git-flow, and there seems some cruft on github/in the git...as:

git branch -m master release

works like a charm. but then:

git push -u origin release

gets me a

Total 0 (delta 0), reused 0 (delta 0)
To github.com:benzkji/django-painless-redirects.git
 ! [remote rejected] release -> release (cannot lock ref 'refs/heads/release': 'refs/heads/release/0.3.5' exists; cannot crea 'refs/heads/release')

As far as I can tell, either this was by my bad (pushing a release branch created by git-flow to github, somewhen in the past), or this is by design, because the tag 0.3.5 was on the release branch...anyway, I dont know a way to solve this (rename an already deleted branch?! woot)

Maybe important: master is currently not the default branch on github, this is develop.

Credits - I've got the two basic lines from Scott: https://www.hanselman.com/blog/EasilyRenameYourGitDefaultBranchFromMasterToMain.aspx

benzkji
  • 1,718
  • 20
  • 41
  • 1
    https://stackoverflow.com/search?q=%5Bgit%5D+ref+exists+cannot+create – phd Jun 22 '20 at 12:20
  • 1
    The remote repository has a branch `release/0.3.5` so git cannot create `release`. Use a different name. Or remove branch `release/0.3.5` from the remote repo. – phd Jun 22 '20 at 12:20
  • 1
    @phd true. but `release` is not the same as `release/0.3.5`? aahh, If branch b exists, no branch named b/anything can be created. (https://stackoverflow.com/questions/22630404/git-push-refs-heads-my-subbranch-exists-cannot-create) – benzkji Jun 22 '20 at 12:29
  • 1
    `git push --delete origin release/0.3.5` and it worked. no other of those release branches where around, so possibly a wrong move/push by myself, during a release... thx! – benzkji Jun 22 '20 at 12:29
  • feel free to pack this in an answer that I would gladly accept :-) – benzkji Jun 22 '20 at 12:30

0 Answers0