Git: How to handle git libraries in project
I've a Xcode project which itself has Git Source Control. In a Libraries folder I've cloned eight other Git project from GitHub. They are located inside my own Git repository and I've added all these libraries to my git in a commit.
Instead of having the code of all these git libraries in my repository, is there a way to let git download their code from their repo when I make a clone of my repo? Or is it normal to include other git repos inside a project?
Sure do the following:
Open your Terminal and execute the following commands
cd /path/to/your/main/repo
git submodule add git@github.com:someuser/somerepo.git somerepo
git commit -m "Added submodules"
Now instead of copying those files you'll have a reference to the other repository in your project:
http://i.minus.com/jcphKnFxLexk8.png
Edit:
Now if you want to update the submodule to a more recent commit you can do the following:
cd somerepo
git pull # You can also checkout a branch / tag etc.
cd ..
git add somerepo
git commit -m "Telling the main repo to update the reference to the referenced repo"
你可以像这样使用git子模块和克隆版本库
链接地址: http://www.djcxy.com/p/92406.html上一篇: 忘记使用
下一篇: Git:如何处理项目中的git库