2016-06-24 42 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 

所以,問題就迎刃而解了