【发布时间】:2016-06-24 09:40:22
【问题描述】:
假设我们有一个带有 master 和 dev 分支的 Assets 项目 和另一个名为 TheProject 的项目。
我想远程添加only Assets 项目的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
但如果它有效,我现在就不会问了!有什么想法吗?
【问题讨论】: