假设我们有一个与主和 dev 分支的资产项目 和另一个名为TheProject的项目。
我想远程添加仅资产项目的 dev 分支。
如果我想添加整个Assets项目,我会这样做:
#Add a new remote URL pointing to the separate project that we're interested in
git remote add -f ASSETS git@example/assets.git
#Merge the Assets project into the local Git project
git merge -s ours --no-commit ASSETS/master
#Create a new directory called ASSETS, and copy the Git history of the Assets project into it
git read-tree --prefix=ASSETS/ -u ASSETS/master
#commit the changes to your master branch
git commit -m "Subtree merged in spoon-knife"
git push
但不管怎么说,这不是我需要的。我想的是:
git remote add -f ASSETS --single-branch dev git@example/assets.git
但如果它奏效我现在就不会问!有什么想法吗?
答案 0 :(得分:0)
实际上我发布的代码确实是我想要的......
git read-tree --prefix=ASSETS/ -u ASSETS/master
#adds only the master branch
git read-tree --prefix=ASSETS/ -u ASSETS/dev
#adds only the dev branch
问题解决了