git switch
安全ブランチ切替(新方式)
git switch <branch>
checkoutのブランチ機能を分離した新コマンド。-cで作成して切替。ファイル復元はrestoreが担当。
実行例
git switch -c feature/loginブランチを作成して切替
書式
git switch [-c] <branch>
実行前の注意
未コミット変更がある時の切替に注意。
この症状のとき使う
関連コマンド
- git switch / checkoutブランチ切替
- git branchブランチ操作
- git restore変更の取り消し