[英]Merge files from same project but completely independent commit history from one git repository into another
My team has been working on a project with another team. 我的团队一直在与另一个团队合作进行项目。 They have a remote repository which my team was not initially given access to.
他们有一个远程存储库,最初我的团队没有访问这些存储库。 Instead, we were given a zip file containing the code but none of the commit history.
相反,我们得到了一个包含代码的zip文件,但没有提交历史记录。 We created our own git repository from this code which now has about 30 commits in branch master.
我们从此代码创建了自己的git存储库,该代码库现在在分支master中有大约30个提交。
Now, the other team have given us access to their repository and want us to create a new branch on their remote containing our changes, which they will later merge with theirs as they see fit. 现在,另一个团队已使我们能够访问其存储库,并希望我们在其远程上创建一个新分支,其中包含我们的更改,他们以后将在适当时将其与他们的合并。
What is the best way to accomplish this? 做到这一点的最佳方法是什么?
Maintaining the commit history from our repository would be nice, but isn't crucial. 从我们的存储库中维护提交历史记录会很好,但不是很关键。 Moving forward we will most likely be working exclusively off of their remote.
展望未来,我们很可能将完全不在他们的遥控器范围内工作。 I don't know exactly which commit the code they gave us was taken from, but could probably find out if it's useful.
我不知道他们提供给我们的代码是从哪个提交中提取的,但是可能会发现它是否有用。
I've tried adding their server as a new remote to my local repository and pulling in their code, but I haven't been able to wrap my head around how exactly to combine the two. 我曾尝试将他们的服务器添加为本地存储库的新远程服务器,并提取他们的代码,但是我还无法完全结合两者。 I've also considered just copying the files on top of a fresh clone from their repository and creating the branch from that, but I'm afraid that will cause us to lose the changes they have made.
我还考虑过仅从其存储库中复制一个新克隆上的文件,然后从中创建分支,但是恐怕这会导致我们丢失所做的更改。
Your original idea is the way to go. 您最初的想法是要走的路。
If necessary delete your master and fetch and pull their master branch. 如有必要,请删除您的master并获取并拉出他们的master分支。
This is what we did when we had to combine a fork that was under development for almost a year into our repo. 这是我们不得不将已经开发了将近一年的分叉组合到我们的仓库中时所做的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.