我是Git的新手,在尝试解决这个问题时真的需要帮助,因为我对如何解决这个问题感到很困惑。
假设我在Github,Repo1和Repo2中有两个回购。 Repo1是我的个人回购,包含一个软件。 Repo2是其他内容的一部分,包含与Repo1相同的内容(它是一个分支)。
前段时间我设法弄乱了Repo1,并设法用不正确的信息更新Repo2。在我试图解决这两个问题时,我确实成功修复了Repo1,但强制更新了Repo2,其中包含来自Repo1的文件(使用Github for Mac),它使用正确的文件更新了Repo2,但完全弄乱了Repo2的历史记录。
现在我可以正确更新Repo1,但每当我尝试将Repo1(上游)中的文件提取到我的本地Repo2时,我会收到合并错误。我尝试使用这里给出的解决方案: Resolve conflicts using remote changes when pulling from Git remote 这似乎修复了本地Repo2(但我不确定......),但是当我尝试将结果推送到Github上的Repo2时,我收到以下错误消息:
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'https://github.com/folder/Repo2.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
我不关心Repo2的历史;我只想用Repo1的内容覆盖Repo2的全部内容,并消除任何后续问题。我怎么能这样做?
请帮助,因为我发现处理这整个混乱非常令人沮丧,我不知道我在做什么。
答案 0 :(得分:2)
答案 1 :(得分:0)
github上的Repo2似乎领先于您当地的Repo2版本。你需要从github获取和合并或获取和重新绑定才能再次推送它。