323

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

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

4

2 に答える 2

490

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

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>現在のブランチの名前を変更する場合は、オプションです。

于 2010-10-05T19:25:10.157 に答える