[英]Preserving history of GIT commits while moving a GIT repository
I have two GIT projects A and B(empty project). 我有两个GIT项目A和B(空项目)。 I want to move the entire project A into project B and preserve the history of commits while moving all the files from A to B.
我想将整个项目A移到项目B中并保留提交历史,同时将所有文件从A移到B。
What's an efficient way to do this using GIT ? 使用GIT进行此操作的有效方法是什么? I tried using git filter-branch but seems like I am not doing it the right way as it gives me "fatal...xyz/is outside repository".
我尝试使用git filter-branch,但是好像我做的方式不正确,因为它给我“致命的……xyz /在存储库之外”。 Could someone give some pointers ?
有人可以指点一下吗?
Thanks ! 谢谢 !
Here is the complete workflow described in our question's comments. 这是问题注释中描述的完整工作流程。
I assume that you want to push the entire history of branch master
from Project A to Project B . 我假设您想将分支
master
的整个历史从Project A推送到Project B。
Project B folder > Initialize the git repo: 项目B文件夹 >初始化git repo:
git init
Project A folder > Add Project B repo as a new remote: 项目A文件夹 >将项目B存储库添加为新的远程站点:
git remote add remoteb <urlToB>
Project A folder > Checkout the appropriate branch (if required): 项目A文件夹 >检出相应的分支(如果需要):
git checkout master
Project A folder > Push the entire history of branch master
to remoteb
: 项目A文件夹 >将分支
master
的整个历史记录推送到remoteb
:
git push -u remoteb master
If you want additional information about the git push
command and parameters, you can find the official documentation here: git push Documentation 如果您需要有关
git push
命令和参数的其他信息,可以在这里找到官方文档: git push文档
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.