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?

gitでmainからブランチを切る方法

Last updated at Posted at 2025-03-25

手順(Gitコマンド)

git checkout main              # ① mainブランチに移動(まだなら)
git pull origin main           # ② 最新の状態を取得(忘れがちだけど大事)
git checkout -b ブランチ名  # ③ 新ブランチを作成して移動

これで main をベースに 入力したブランチ名のブランチができて、そのブランチに移動まで完了する。

忘れずに origin にプッシュ(初回だけ)

git push -u origin ブランチ名

-u つけることで次回以降は git push だけで済む!

参考までに

ブランチの強制削除

git branch -D ブランチ名
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?