2016-06-24 37 views
0

添加一个分支假设我们有一个资产项目,开发分支 和其他项目命名TheProject。如何远离仓库

我想远程添加只有dev Assets项目的分支。

如果我想添加整个资产项目,我会做:

#Add a new remote URL pointing to the separate project that we're interested in 
git remote add -f ASSETS [email protected]/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 [email protected]/assets.git 

但是,如果它的工作,我不会问现在!有任何想法吗?

回答

0

其实我发布的代码做exaclty我想要的东西..

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 

所以,问题就迎刃而解了