LoginSignup
15
11

More than 1 year has passed since last update.

git branch -m(-M) オプションってなに!?

Last updated at Posted at 2021-04-06

説明

-m (もしくは-M)オプションで
ブランチ名の変更が出来ます

githubでリポジトリ作成したときなんかも

git branch -M main

なんて書かれてますね

つかいかた

git branch -m ブランチA

現在のブランチ名をブランチAに名前変更

git branch -m ブランチA ブランチB

ブランチAをブランチBに名前変更

git branch -M ブランチA

現在のブランチ名をブランチAに強制変更

git branch -M ブランチA ブランチB

ブランチAをブランチBに強制名前変更

大文字 -M 小文字 -m の違いは?

小文字 -m 変更後の名前と同名ブランチがあると失敗します
大文字 -M は強制上書き

15
11
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
15
11