0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

デフォルトブランチをmainからdevelopに変更する

Last updated at Posted at 2025-12-30

はじめに

GitHub上のデフォルトブランチはmainになっていることが多いですが、業務等developブランチで作業することが多かったりして、個人的にはdevelopで作業するほうがしっくりくるな〜と感じたので、デフォルトブランチの変更方法を備忘として残したいと思います。

1. ローカルでブランチ名を変更する

git branch -m main develop

2. リモートのブランチ情報を更新する

git push origin develop

↓以下はやるかやらないかは個人の好みかなと思います。私はメインで作業するのをdevelopで完結させてしまいたいだけなので、形式上リモート上のmainは残して作業をしています。

3. main を廃止

  • ローカルの main ブランチを削除(ローカルで不要なら)
git branch -d main
  • GitHub上でリモートの main を削除
git push origin --delete main

これでこの設定以降はデフォルトブランチをdevelopにして開発を進めることが出来ます。
なお、途中からブランチ名を変更した場合、VercelなどのCI/CD設定、MicroCMSのWebhookの設定などは合わせて見直す必要があります。

0
0
0

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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?