ドキュメントには頻繁に更新が加えられ、その都度公開されています。本ページの翻訳はまだ未完成な部分があることをご了承ください。最新の情報については、英語のドキュメンテーションをご参照ください。本ページの翻訳に問題がある場合はこちらまでご連絡ください。

Renaming a branch

You can change the name of a branch in a repository.

People with write permissions to a repository can rename a branch in the repository. People with admin permissions can rename the default branch.

ここには以下の内容があります:

About renaming branches

You can rename a branch in a repository on GitHub. For more information about branches, see "About branches."

If you rename a branch, GitHub will automatically redirect links on GitHub.com that contain the old branch name to the equivalent link on the renamed branch. GitHub will also update branch protection policies, as well as the base branch for open pull requests and draft releases.

Renaming a branch

  1. GitHubで、リポジトリのメインページにアクセスしてください。
  2. ファイルのリストの上部で NUMBER branchesをクリックしてください。
    概要ページのブランチリンク
  3. In the list of branches, to the right of the branch you want to rename, click .
    Pencil icon to the right of branch you want to rename
  4. Type a new name for the branch.
    Text field for typing new branch name
  5. Review the information about local environments, then click Rename branch.
    Local environment information and "Rename branch" button

Updating a local clone after a branch name changes

After you rename a branch in a repository on GitHub, any collaborator with a local clone of the repository will need to update the clone.

From the local clone of the repository on a computer, run the following commands to update the name of the default branch.

$ git branch -m OLD-BRANCH-NAME NEW-BRANCH-NAME
$ git fetch origin
$ git branch -u origin/NEW-BRANCH-NAME NEW-BRANCH-NAME

Did this doc help you?

Privacy policy

Help us make these docs great!

All GitHub docs are open source. See something that's wrong or unclear? Submit a pull request.

Make a contribution

OR, learn how to contribute.