Gitリポジトリのブランチ名を変更する 質問する

Gitリポジトリのブランチ名を変更する 質問する

Git リポジトリ内の既存のブランチの名前を変更するにはどうすればよいですか?

現在のブランチに新しい名前を付けたいです。

ベストアンサー1

名前を変更したいブランチに現在いると仮定します:

git branch -m newname

これはのマニュアルに記載されておりgit-branch、以下を使用して閲覧できます。

man git-branch

または

git help branch

具体的には、コマンドは

git branch (-m | -M) [<oldbranch>] <newbranch>

ここでパラメータは次のとおりです。

   <oldbranch>
       The name of an existing branch to rename.

   <newbranch>
       The new name for an existing branch. The same restrictions as for <branchname> apply.

<oldbranch>現在のブランチの名前を変更する場合はオプションです。

おすすめ記事