ブランチ切り替え時の git エラー
ブランチを切り替える:
[root@git my_code]# git checkout master
次のエラーが生成されます。
error: pathspec 'master' did not match any file(s) known to git.
解決:
1. ブランチのステータスを確認します。
[root@git my_code]# git branch -a
2. 必要なブランチが見つからない場合は、まずすべてのブランチを取得します。
[root@git my_code]# git fetch
3. この時点で分岐状況を再度確認します
[root@git my_code]# git branch -a
目的のブランチが表示されていることがわかります
4. ブランチを切り替える
[root@git my_code]# git checkout master
[root@git my_code]# git branch --list
この時点で、分岐の切り替えは成功し、問題は解決されます。