简体   繁体   English

如果旧的存储库不在线,如何将所有提交历史记录保存在旧的存储库中,并将其内容移动到新的存储库中?

[英]How to keep all commit history in an old repo and move its content into a new one if the old repository doesn't exist online?

the situation is that I have a local copy of one repository which has all commit history in its git log. 情况是我有一个存储库的本地副本,该副本的git日志中包含所有提交历史记录。 It was the course repository that I used for last semester, and now the instructor has cleaned up that repository online - so it only exists on my computer. 这是我上学期使用的课程资料库,现在,讲师已经在线清理了该资料库-因此它仅存在于我的计算机上。

I would love to keep all the commit history and move its content to a new repo. 我希望保留所有提交历史记录并将其内容移至新的存储库。 However, when I try to push remotely Git raised the error of cannot read from remote repository. 但是,当我尝试远程推送时,Git引发了无法从远程存储库读取的错误。

In this case, what can I do to keep the git log and move all contents to a newly-created repo? 在这种情况下,我该如何保存git日志并将所有内容移至新创建的仓库中?

Many thanks in advance! 提前谢谢了!

You'll need to change the origin of your repo to the new location: https://www.ethode.com/blog/git-change-remote-origin 您需要将存储库的来源更改为新位置: https : //www.ethode.com/blog/git-change-remote-origin

With that everything including the git log will be pushed to the new location. 这样,包括git日志在内的所有内容都将被推送到新位置。

$ git remote rm origin
$ git remote add origin git@github.com:username/repositoryName.git
$ git config master.remote origin
$ git config master.merge refs/heads/master

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何创建一个新的 Git 存储库而不是旧的存储库并保留提交历史? - How to create a new Git repo instead of an old one and keep the commits history? 如何将新项目添加为提交而不是旧项目而不丢失历史记录? - How to add a new project as a commit instead of an old one and not lose history? Git 在新的父提交之上从一个父提交变基(没有旧的父提交作为其父提交之一) - Git rebase from one parent commit on top of a new parent commit (that doesn't have the old parent commit as one of its parents) 如何将文件及其所有提交历史记录迁移到git中的新仓库中? - How to migrate a file and all its commit history to a new repo in git? 如何将新提交从旧存储库移到新存储库 - How to move new commits from old repository to new one 端口 Git 从旧回购到现在已有几个月的新回购的历史,有自己的历史吗? - Port Git history from old repo to new repo that's now months old, with its own history? 从旧提交进行新的回购,保持历史 - Make new repo from old commit keeping history up to then 如何在没有旧提交的情况下将分支文件从旧存储库移动到新存储库 - How can I move branch files from an old repository to a new one without the old commits 将旧提交移动到新分支 - Move Old Commit to New Branch 在新的 Git 存储库中有新的主要版本,但保留旧的存储库并拥有完整的历史记录 - Have new major version in new Git repo but keep old repo and have full history
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM