Redirect web requests for the old branch name to the new branch name.Show a notice to contributors who git push to the old branch.Show a notice to repository contributors, maintainers, and admins on the repository homepage with instructions to update local copies of the repository.Update the branch used to build GitHub Pages, if applicable.Move any branch protection rules that explicitly reference the old name.Update any draft releases based on the branch.This is a better approach, because renaming a branch that way (on ) will ( source): See " How do I rename branch on the GitHub website?". 2021) " Support for renaming an existing branch" (protected branches can only be renamed by admins, see the end) On GitHub side, you can use the new (Jan. Note that positional arguments in shell commands were problematic in older (pre 2.8?) versions of Git, so the alias might vary according to the Git version. Usage: git branchm origin old_branch new_branch This can be turned into a simple alias that takes the remote, original branch and new branch name as arguments, in ~/.gitconfig: īranchm = "!git branch -m $2 $3 & git push $1 :$2 $3 -u #" This will both delete the old branch and push the new one. Note that you can combine the 2 push operations: I've always thought this to be completely kludgy, but it's the way it's done.Īs of Git 1.7 there is an alternate syntax for deleting a remote branch: git push origin -delete name_of_the_remote_branch So doing a push with no local_branch specified essentially means "take nothing from my local repository, and make it the remote branch". Git push origin new_name_of_the_branch_that_is_localĭissecting the commands a bit, the git push command is essentially: git push : As mentioned, delete the old one on GitHub and re-push, though the commands used are a bit more verbose than necessary: git push origin :name_of_the_old_branch_on_github
0 Comments
Leave a Reply. |