新建的git仓库同步旧的git仓库代码,并保留git提交历史记录

新建的git仓库同步旧的git仓库代码,并保留git提交历史记录

git remote add $源名称$ 仓库地址
例如:
git remote add abc git@gitlab.xxx.org:xxx/abc.git

然后需要将新建的源代码pull到本地,注意需要添加allow-unrelated-histories

git fetch abc
git merge abc/master --allow-unrelated-histories 

最后

git push abc
posted @ 2023-05-30 18:44  ____chen  阅读(120)  评论(0编辑  收藏  举报