我弄乱了远程存储库,我可以从本地恢复吗?

发布于 2024-10-03 20:02:34 字数 823 浏览 7 评论 0原文

我弄乱了我的远程存储库,我可以恢复它吗?

情况:

  • 笔记本电脑(从存储库中提取,其中 我从另一台笔记本电脑上推送 错误的数据)
  • 桌面(有一个很好的 本地存储库 - 昨天)

桌面

gd@t4q:/var/www/html/t1.org$ git remote show origin
Enter passphrase for key '/home/gd/.ssh/id_rsa': 
* remote origin
  Fetch URL: git@ip:t1_org.git
  Push  URL: git@ip:t1_org.git
  HEAD branch: master
  Remote branches:
    develop tracked
    master  tracked
  Local branches configured for 'git pull':
    develop merges with remote develop
    master  merges with remote master
  Local refs configured for 'git push':
    develop pushes to develop (local out of date)
    master  pushes to master  (up to date)

在桌面上,开发已经过时,由于远程上的信息不同,但错误。

我可以将本地存储库从桌面推送到 git 服务器吗?然后重新应用补丁并将所有内容恢复到我的笔记本电脑上?

如果我确实需要提供更多信息,请告诉我。

TIA, 福西

I've messed up my remote repository, can I restore it?

Situation:

  • laptop (pulled form repository where
    I pushed from another laptop with
    wrong data)
  • desktop (which has a good
    local repository - yesterday)

desktop

gd@t4q:/var/www/html/t1.org$ git remote show origin
Enter passphrase for key '/home/gd/.ssh/id_rsa': 
* remote origin
  Fetch URL: git@ip:t1_org.git
  Push  URL: git@ip:t1_org.git
  HEAD branch: master
  Remote branches:
    develop tracked
    master  tracked
  Local branches configured for 'git pull':
    develop merges with remote develop
    master  merges with remote master
  Local refs configured for 'git push':
    develop pushes to develop (local out of date)
    master  pushes to master  (up to date)

On the desktop, develop is out of date, due information on the remote is different, but wrong.

Can I push local repository from my desktop to my git server? Then reapply patches and pull everything back on my laptop?

If I do need to provide more information, please let me know.

TIA,
Fossie

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

人海汹涌 2024-10-10 20:02:34

您可以使用 git push -f 从本地(良好)存储库强制覆盖。

You can force an overwrite with git push -f from your local (good) repository.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文