[英]How to add two separate git repos into one repo as two directories while preserving commit history?
I was developing a full-stack web application and for that, I created two separate repositories for the front-end and back-end as I develop.我正在开发一个全栈 web 应用程序,为此,我在开发时为前端和后端创建了两个独立的存储库。 The two repositories are,
这两个存储库是,
Now I need to create one repository 'projectName' which contains these two separate git repositories as directories without deleting the commit history.现在我需要创建一个存储库“projectName”,其中包含这两个单独的 git 存储库作为目录,而不删除提交历史记录。
api --> projectName_api git repo api --> projectName_api git repo
client --> projectName_client repo客户端 --> projectName_client 存储库
|projectName
|--api
|--client
|--package.json
It will be better if the history of git repos can be put into branches like frontend and backend with separate history in those branches如果可以将 git 存储库的历史记录放在前端和后端等分支中,并且在这些分支中具有单独的历史记录,那就更好了
The usual approach would be rather to use git submodules , referencing those two repositories in your main project repository.通常的方法是使用git submodules ,在您的主项目存储库中引用这两个存储库。
That way:那样:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.