【Git】作業ブランチを最新にするやり方【pull】

【Git】作業ブランチを最新にするやり方【pull】

2023年2月2日

Gitで作業ブランチを最新にするやり方です。

  • masterブランチ:master
  • 作業ブランチ:feature-hoge
  • 開発用のfeature-hogeブランチに、最新のmasterブランチの内容を取り込みたい場合。

# masterブランチへ移動する
git checkout master

# pullでmasterブランチを最新にする
git pull origin master

# checkoutで開発ブランチへ移動
git checkout feature-hoge

# mergeコマンドでmasterの内容を取り込み
git merge origin master

参考:https://bake0937.hatenablog.com/entry/2017/11/07/081616