gitでローカルブランチの名前を変更したい

gitでローカルブランチの名前を変更したかったのでググってみたら、

git branch -m

とのこと。

でもマニュアルが読みたい。探した。

https://git-scm.com/docs/git-branch

 git branch [--color[=<when>] | --no-color] [-r | -a]
      [--list] [-v [--abbrev=<length> | --no-abbrev]]
      [--column[=<options>] | --no-column] [--sort=<key>]
      [(--merged | --no-merged) [<commit>]]
      [--contains [<commit]] [--no-contains [<commit>]]
      [--points-at <object>] [--format=<format>] [<pattern>…​]
 git branch [--track | --no-track] [-l] [-f] <branchname> [<start-point>]
 git branch (--set-upstream-to=<upstream> | -u <upstream>) [<branchname>]
 git branch --unset-upstream [<branchname>]
 git branch (-m | -M) [<oldbranch>] <newbranch>

mあるね。

 -m
 --move

 Move/rename a branch and the corresponding reflog.

なんかあってそうな雰囲気だね。やってみる。

$ git branch
  aiueo
* develop
  master
  
$ git branch -m aiueo aiueo2

$ git branch
  aiueo2
* develop
  master

ちゃんと変わった。

ちなみに、git helpってコマンド打ったらばーってたくさん説明が出てきたから、

git branch helpって打ったら、helpっていうブランチが作成された。そりゃそうだ。