🌱

git switch new-topic

2020/09/17に公開

git switch リモートのブランチ名 で tracking branch が作成されます。

たとえば git switch new-topicgit checkout -b new-topic origin/new-topic と同じ意味になります。
すでに new-topic というローカルブランチがあれば、単純に切り替わります。

$ git switch new-topic
Branch 'new-topic' set up to track remote branch 'new-topic' from 'origin'
Switched to a new branch 'new-topic'

参考: https://git-scm.com/docs/git-switch/2.23.0

2020-09-17 追記: git checkout new-topic でも同じ挙動ということを教えてもらいました。

Discussion