How do I change the target release branch on GitHub?

I recently released a private repository, but in releasing I made the mistake of releasing it using the development branch as the target branch. Now I want this release to target the master branch and not be developed.

How do I change the target branch to master?
Note. When I edit, the option to change the target branch appears for a second and then disappears.

Do I need to create a new branch?

+3


source to share


2 answers


I agree with @parsenz that there is no way to do this on GitHub (since Enterprise v2.1). You will have to delete and recreate. I'm not a git expert, but here are the steps I followed to "push" a release from one branch to another on GitHub:

On GitHub (web interface):

  • get a copy of the release and commit the hash (usually from a pull request)
  • remove release from GitHub UI

Then in git bash:



  1. git push --delete origin <tag_name> // deletes remote tag

  2. git tag -d <tag_name> // deletes local tag

  3. git checkout <commit_hash>

  4. git tag <tag_name>

  5. git push origin <tag_name>

  6. [optional] git checkout <branch_name>

    (to go back to the previous branch)

Back to GitHub:

  1. recreate the release using the same tag in the github frontend

Note: This usually happens because the release was built against the wrong branch. You can set the default branch for a GitHub repository in the repository settings (tool icon in the right navigation bar).

+1


source


I don't think you can on Github. You must delete the release and recreate it. I solved it by typing the following in my console:

git push origin :refs/tags/{old_tag_name}

      



And then re-create the issue

0


source







All Articles