如何将旧存储库的历史记录连接到已经有提交的新存储库?

huangapple go评论49阅读模式
英文:

How to hook up old repository history to a new repository that already has commits?

问题

抱歉,我只会翻译文本内容,不会回答关于如何进行操作的问题。以下是您提供的文本的翻译:

"I've moved my repository to another location on my local system, and I used the git init command, which made a new repository and created an entirely new history system. I've made a few commits since that happened. The commits on the old local system do not show up on the current local system, which is to be expected, since I made a completely new repository. The commits only exist on GitHub now, and I can only see them because I put tags on those commits. When I go back to those commits, this shows:

如何将旧存储库的历史记录连接到已经有提交的新存储库?

The old commits on the old local system don't show up on the new local environment, because the history was empty, so git reflog does not show the older commits on GitHub.

Git, in the local environment, treats the commits as if they do not exist/are not part of the branch, but I want those commits to be added back onto the tree, so it's easy for me to compare them with each other. (Trying to compare the commits that are not part of the new commit tree shows that they have entirely different commit histories, even though the new commits are changes from the older commits.)

git rebase and git cherry-pick does not work, I've tried those already. git merge does not work, because, in a rush, I've deleted the old local system. The only proof that the commits from the old system exist is the fact that they're on GitHub and have tags attached to them.

In short, I want to add a bunch of commits that are on GitHub to the history of another repository, which already has commits, and push it back onto GitHub so it appears that all those commits are on the same timeline."

英文:

I've moved my repository to another location on my local system, and I used the git init command, which made a new repository and created an entirely new history system. I've made a few commits since that happened. The commits on the old local system do not show up on the current local system, which is to be expected, since I made a completely new repository. The commits only exist on GitHub now, and I can only see them because I put tags on those commits. When I go back to those commits, this shows:

如何将旧存储库的历史记录连接到已经有提交的新存储库?

The old commits on the old local system don't show up on the new local environment, because the history was empty, so git reflog does not show the older commits on GitHub.

Git, in the local environment, treats the commits as if they do not exist/are not part of the branch, but I want those commits to be added back onto the tree, so it's easy for me to compare them with each other. (Trying to compare the commits that are not part of the new commit tree shows that they have entirely different commit histories, even though the new commits are changes from the older commits.)

git rebase and git cherry-pick does not work, I've tried those already. git merge does not work, because, in a rush, I've deleted the old local system. The only proof that the commits from the old system exist is the fact that they're on GitHub and have tags attached to them.

In short, I want to add a bunch of commits that are on GitHub to the history of another repository, which already has commits, and push it back onto GitHub so it appears that all those commits are on the same timeline.

答案1

得分: 0

我在旧的提交记录上创建了一个新分支,将该分支与旧的提交记录合并到当前提交记录,然后将其推送回GitHub,这样看起来所有的提交都有一个共享的历史。

英文:

I created a new branch at the old commits, merged the branch with the old commits to the current commits and then pushed that back onto GitHub, so it appears that all the commits have one shared history.

huangapple
  • 本文由 发表于 2023年5月22日 09:48:21
  • 转载请务必保留本文链接:https://go.coder-hub.com/76302620.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定