Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I rename branch on the GitHub website?

I don't know how to run command line stuff. I just don’t have the environment.

So I'm trying to rename a branch on the GitHub website. It was, by default, named patch-1.

Is it possible to rename it on the site?

like image 851
Noitidart Avatar asked May 24 '14 23:05

Noitidart


People also ask

How do I rename a branch in repository?

The steps to change a git branch name are: Rename the Git branch locally with the git branch -m new-branch-name command. Push the new branch to your GitHub or GitLab repo. Delete the branch with the old name from your remote repo.


1 Answers

I just did it without downloading any code to my laptop and using only the GitHub site. The solution looks the same as @swcool’s, but I want to add about the default branch.
In my case, the name of the renaming branch did not exist.

  1. Change the default branch (to the old branch you want to rename)

  2. Create a new branch (with a new name)

    This action will copy all the contents of the default branch (the branch with the old name) to the new branch (with a new name). At this time, you have two branches with the same code.

  3. Change the default branch (to the new one with a new name)

  4. Delete the old branch

like image 79
allenhwkim Avatar answered Sep 19 '22 02:09

allenhwkim