将克隆的 TFS 回购推送到具有历史记录的私人回购
Pushing cloned TFS repo to a private repo with history
我使用 git-tfs clone <tfs-url>
命令将 TFS 存储库克隆到我的本地计算机,完成后,我打开文件夹并执行 git 日志,我可以看到所有美丽的历史。
现在,当我创建一个新的私有存储库并将该存储库克隆到我的本地时,然后将 TFS 中的所有对象(我刚刚克隆到我的本地)复制粘贴到新的存储库中,然后 git push
它,我没有看到美丽的历史,只有 1 个我将它推送到新仓库的历史。我需要完整保留 TFS 存储库中的旧历史记录。我该怎么做?
此外,idk 如果它有帮助,但是当我在本地计算机上打开克隆的 TFS 文件夹并执行 git remote -v 时,根本没有远程,它只是空的,我想 git-tfs clone
会自动添加 git 远程,但它不会。与 git clone
不同,后者会自动创建一个名为 origin 的远程连接,指向 here
中所述的克隆存储库
Now, when I create a new private repo and clone that repo to my local then copy paste all the objects from TFS (that i just cloned to my local) into the new repo and git push it, I dont see the beautiful history, only 1 history of me pushing it to the new repo. I need to have the old history from TFS repo intact. How do I do that?
你所做的不是推动你的历史,而是提交你的源代码的尖端。
查看我在 git-tfs 文档中写的内容,向您新创建的 git 存储库添加远程并推送历史记录:
Also, idk if it helps but when I opened the cloned TFS folder on my local machine and I do git remote -v, there is nothing no remote at all, its just empty, i thought git-tfs clone would add git remote automatically but it doesnt.
这是 git-tfs 做不到的,也没有任何意义。 Git-tfs 不知道新创建的存储库(并且不要将 TFVC link 作为 git 远程管理以免混淆用户)。
I need to have the old history from TFS repo intact.
对于 Git,只需使用导入存储库功能,您就可以将 Git 存储库从其他项目的 git 存储库导入到您的团队项目中。新导入的 repo 将保留所有提交历史记录。具体可以参考这个document.
TFS 2017 Update 1中引入了import repo功能。如果您使用的是TFS 2017 RTM或更早版本,您可以使用以下步骤manually import a repo into TFS。
git clone --bare {clone repo url}
cd repo name.git
git push --mirror {target repo url}
如果不知道路径,我们可以调用cmd dir
加载文件列表,然后找到路径。
nvm 找到了答案
git remote add <origin-url>
git push origin master
我使用 git-tfs clone <tfs-url>
命令将 TFS 存储库克隆到我的本地计算机,完成后,我打开文件夹并执行 git 日志,我可以看到所有美丽的历史。
现在,当我创建一个新的私有存储库并将该存储库克隆到我的本地时,然后将 TFS 中的所有对象(我刚刚克隆到我的本地)复制粘贴到新的存储库中,然后 git push
它,我没有看到美丽的历史,只有 1 个我将它推送到新仓库的历史。我需要完整保留 TFS 存储库中的旧历史记录。我该怎么做?
此外,idk 如果它有帮助,但是当我在本地计算机上打开克隆的 TFS 文件夹并执行 git remote -v 时,根本没有远程,它只是空的,我想 git-tfs clone
会自动添加 git 远程,但它不会。与 git clone
不同,后者会自动创建一个名为 origin 的远程连接,指向 here
Now, when I create a new private repo and clone that repo to my local then copy paste all the objects from TFS (that i just cloned to my local) into the new repo and git push it, I dont see the beautiful history, only 1 history of me pushing it to the new repo. I need to have the old history from TFS repo intact. How do I do that?
你所做的不是推动你的历史,而是提交你的源代码的尖端。
查看我在 git-tfs 文档中写的内容,向您新创建的 git 存储库添加远程并推送历史记录:
Also, idk if it helps but when I opened the cloned TFS folder on my local machine and I do git remote -v, there is nothing no remote at all, its just empty, i thought git-tfs clone would add git remote automatically but it doesnt.
这是 git-tfs 做不到的,也没有任何意义。 Git-tfs 不知道新创建的存储库(并且不要将 TFVC link 作为 git 远程管理以免混淆用户)。
I need to have the old history from TFS repo intact.
对于 Git,只需使用导入存储库功能,您就可以将 Git 存储库从其他项目的 git 存储库导入到您的团队项目中。新导入的 repo 将保留所有提交历史记录。具体可以参考这个document.
TFS 2017 Update 1中引入了import repo功能。如果您使用的是TFS 2017 RTM或更早版本,您可以使用以下步骤manually import a repo into TFS。
git clone --bare {clone repo url}
cd repo name.git
git push --mirror {target repo url}
如果不知道路径,我们可以调用cmd dir
加载文件列表,然后找到路径。
nvm 找到了答案
git remote add <origin-url>
git push origin master