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?
source to share
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:
-
git push --delete origin <tag_name> // deletes remote tag
-
git tag -d <tag_name> // deletes local tag
-
git checkout <commit_hash>
-
git tag <tag_name>
-
git push origin <tag_name>
- [optional]
git checkout <branch_name>
(to go back to the previous branch)
Back to GitHub:
- 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).
source to share