远程回购说它是最新的,但是缺少数百个本地提交 [英] Remote repo says it is up-to-date, but lacks hundreds of local commits

查看:69
本文介绍了远程回购说它是最新的,但是缺少数百个本地提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Eclipse中(使用Egit),我的存储库设置如下:

In Eclipse (using Egit) I have my repo set up like this:

我从github.com/hallvard/tdt4100-2017的远程GitHub存储库(我的讲师)中提取 我添加文件并修改一些我从那里提取的文件.使用Eclipse的egit,我将更改提交到本地存储库(包括来自远程请求存储库的所有文件.),并将所有内容推送到我自己的GitHub存储库中,然后在其中拥有我自己的所有文件,讲师的文件以及讲师的修改内容.文件. 该仓库位于github.com/vegarab/tdt4100

I pull from a remote GitHub repo (my lecturer's) at github.com/hallvard/tdt4100-2017 I add files and modify a few of the ones I pull from there. Using Eclipse's egit, I commit changes to my local repo (including all files from the remote pull repo.), and push everything to my own GitHub repo where I then have all of my own files, and my lecturer's files, and my lecturer's modified files. That repo is at github.com/vegarab/tdt4100

昨天发生了一件奇怪的事情:当推送到我自己的仓库时,它一直说master分支是最新的,但事实并非如此. ,我确实登台了文件,并将它们提交到本地存储库中.

Yesterday something weird happened: When pushing to my own repo., it kept saying the master branch was up-to-date, which it was NOT. YES I did stage the files, and they were commited to the local repo.

我尝试去终端并从那里推到远程,但是没有运气.

I tried going to terminal and pushing to remote from there, but no luck.

我回顾了GitHub的历史,找到了最后一个提交,并做了:

I headed to my GitHub history and found the last commit, and did a:

git reset commitid

然后我尝试推送到遥控器,但是它仍然说它是最新的?嗯? 我复制了本地存储区只是为了确保如果出现问题,我仍然可以保存文件: 我做了

I then tried to push to the remote, but it still said it was up-to-date? EH WHAT? I copied my local repo just to make sure I still had my files if something went wrong: I did a

git pull -f origin master

它做了一些更改:我的远程回购只是讲师回购的一个分支.我所有的文件都消失了,除了它们仍在本地存储库中.尝试推送它们会提供另一个最新信息,除了远程现在会丢失我自己的提交的杂音以及数百个文件和文件夹.

and it did some changes: My my remote repo is just a fork of the lecturer's repo. All my files are gone, except they are still there in the local repo. Trying to push them gives yet another up-to-date, except the remote now misses hunders of my own commits, and hundreds of files and folders.

做什么?

推荐答案

我最终推送了本地备份存储库.到远程站点,从而将远程站点恢复"到正确的状态.

I ended up pushing the local backup repo. to the remote one, which "restored" the remote one into the correct state.

然后我删除了原来的本地存储库,并从远程存储库中创建了一个新的本地存储库.然后,我从讲师那里提取了新的更改并推送到我自己的仓库中.现在已修复.

I then deleted the original local repo, and created a new one, pulling from my remote repo. I then pulled new changes from lecturer and pushed to my own repo. It is now fixed.

这篇关于远程回购说它是最新的,但是缺少数百个本地提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆