LoginSignup
1
0

More than 3 years have passed since last update.

git 新しいブランチを作成する

Posted at

新しいブランチを作成する

まず、cdコマンドで現在作成中のアプリケーションのディレクトリに移動して、そこで、gitコマンドを入力する。
ディレクトリの移動後は、元のマスターブランチに一旦戻って、そこで、ブランチ作成コマンドを入力する。

現在のブランチの確認
$ git branch -a
# 以下のように現在のブランチの状況が表示される
* main =>  いまここ
  remotes/heroku/master
  remotes/origin/main
# 元のブランチにいるか確認する

次に、新しいブランチを作成するコマンドを入力して、新規ブランチを作成する。

新規ブランチの作成
$ git checkout -b "リポジトリ名"
Switched to a new branch '時刻表示の実装'

これで新しくブランチが作成できました。
ちなみにブランチを移動する場合は、以下のコマンドを入力します。

ブランチの移動
$ git checkout "移動したいブランチ名"

これで、ブランチを変えることができます。

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