0
0

More than 3 years have passed since last update.

git ローカルでのブランチの基本操作

Last updated at Posted at 2021-08-23

ローカルブランチの基本操作

ローカルリポジトリまで移動

cd ディレクトリパス

ブランチを確認

* 現在のブランチを確認
 * git branch 
* ブランチ一覧を表示
 * git branch -a

ブランチの作成

git branch ブランチ名 派生元のブランチ名

ブランチの切り替え

git switch ブランチ名
(git checkout でも同じ挙動だが現在は、`git switch` を推奨)

ブランチの作成と切り替えを一緒に行う

git switch -c ブランチ名 派生元のブランチ名 

マージする

1.操作したいブランチに切り替え
git switch ブランチ名

2.マージして取り込む
git merge マージ対称ブランチ

ブランチを削除

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