我有几个 Visual Studio 解决方案,它们既有本地存储库,也有 GitHub 上的一个。我已经进行了许多更改并成功地将这些更改推送到了 GitHub。
但是现在 Visual Studio 忘记了我的本地存储库之一与 GitHub 存储库相关联,我似乎无法弄清楚如何重新连接它。事实上,它不再在我的 GitHub 存储库列表中列出该存储库。
在下图中,您可以看到我有一个名为 Toxic 的本地存储库,但该存储库并未出现在 GitHub 存储库列表中。如果我尝试将 Toxic 项目发布到 GitHub,它只会告诉我存储库已经存在。
我到底如何才能让我所有现有的 Github 存储库显示在上面显示的顶部,以便我可以推送我的最新更改?
最佳答案
it appears the only option is to clone the GitHub repository locally, copy my modified files over the newly created repository, and then check in my changes.
试试拳头:
那是:
git clone https://github.com/<user>/<repo> newFolder
cd newFolder
git remote add old ../path/to/old/local/repo
git fetch old
git log old/master
git cherry-pick old-sha1..old/master
( old-sha1 是您想要返回的第一个提交)
然后在您的 Visual Studio 工作区中添加 newFolder,并查看是否一切正常(进行修改、添加、提交和推送)
关于visual-studio - 将当前代码推送到现有的 GitHub 存储库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56741930/