Git submodule !Unable to checkout !應對辦法

從github克隆使用了git子模塊的倉庫,因網絡問題導致子倉庫下載出錯,命令行裏會提示如:

Unable to checkout '726d14d02c95bb21ec9e43807751b491d295dd3c' in submodule path 'third_party/ktx'

解決辦法:

1.進入子模塊目錄,重置

git reset --hard

2.檢出確認

git checkout master

3.返回主倉庫目錄,查看狀態;提示子倉庫有修改,一般commit號不對應

$ git status
On branch master
Your branch is up to date with 'origin/master'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   third_party/ktx (new commits)

4.更新子模塊,匹配commit

$ git submodule update
Submodule path 'third_party/ktx': checked out '726d14d02c95bb21ec9e43807751b491d295dd3c'

5.確認

$ git status
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章