How to revert a Git Submodule pointer to the commit stored in the containing repository?

前端 未结 7 1137
感动是毒
感动是毒 2021-01-29 22:44

I have a git submodule in my main git repo. As I understand it, the main repo stores a SHA value (somewhere...), pointing to the specific commit of the submodule that it is \"li

7条回答
  •  情歌与酒
    2021-01-29 23:20

    An updated visual walk through - here my submodule is pointing at - 8c3fd8b It would be straightforward to go to this folder and....

    git checkout master
    error: pathspec 'master' did not match any file(s) known to git
    

    In the submodule eg. stylegan2-ada folder needed to run

    git checkout main
    git pull
    

    this resolved my problem (temporarily)

    last step was to commit the changes in parent repo. The tracked changes appeared automatically - and I didn't need to create a file - just stage the file changes by clicking the + in vscode and pushing.

    here very clearly you can see the git commits refreshing.

    -Subproject commit 8c3fd8bac3e5a54a20e860fc163d6e67cc03c623
    +Subproject commit 0045ea50f1b9710ffde3ab2a9a18c0d4c97bfaed
    

    Troubleshooting

    Beware that there's a .gitsubmodule file that points to respective git remote repo.

提交回复
热议问题