Replaced third party code with git submodules, now I can't switch branches

前端 未结 2 775
轻奢々
轻奢々 2020-12-28 08:27

Here\'s the story: I have 2 git branches master and develop I\'m currently on develop.

I\'ve long since had the source files o

相关标签:
2条回答
  • 2020-12-28 08:37

    Unfortunately, I think this is just one of the drawbacks of using submodules. These problems are described in a section called "Issues with Submodules" in Pro Git, but in short, the simplest workaround is to move the submodule directory out of the way before switching to the master branch:

    mv Vendor Vendor.moved
    git checkout master
    

    Similarly, when you change to develop, you should do:

    git checkout develop
    mv Vendor.moved Vendor
    
    0 讨论(0)
  • 2020-12-28 08:50

    Now it can be made easier. Use command git checkout -f master.

    0 讨论(0)
提交回复
热议问题