因为历史原因,我们将不同版本的源代码放在不同的git存储库中。 因此,尽管Project A持有源代码的版本X,但Project B持有版本Y的源代码。
您知道将Project B作为Project A的分支导入的方法吗?
谢谢
因为历史原因,我们将不同版本的源代码放在不同的git存储库中。 因此,尽管Project A持有源代码的版本X,但Project B持有版本Y的源代码。
您知道将Project B作为Project A的分支导入的方法吗?
谢谢
.git
目录中。分支只是指向提交的名称。git remote add B git://url.to/project.B.git
git fetch B
以B分支为基础进行工作
git checkout -b newname remotes/B/branchname
将从一个中央仓库获取的分支推送到另一个中央仓库:
git push origin remotes/B/branchname:branchname
或者反过来
git push B remotes/origin/master:othername
大部分时候,您可以省略remotes/
前缀。使用Git很容易实现。您需要将B项目添加为远程仓库,然后进行获取(fetch):
git remote add projectB git://url.to/projectB.git
git fetch projectB
git clone {git hub 项目 A 的 URL}
git remote add projectBrepo {git hub 项目 B 的 URL}
git fetch projectBrepo
git branch -v -a
git checkout -b master_old remotes/projectBrepo/master
git push origin master_old
git checkout -b branch_name1 remotes/projectBrepo/branch_name1
git push origin branch_name1