GIT不会从远程获取最新更改 [英] GIT won't pull latest changes from remote

查看:47
本文介绍了GIT不会从远程获取最新更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以某种方式,我的本地分支机构比远程分支机构滞后了8个月.

当我执行git pull origin [my branch name]时,它会显示Already up to date.

我尝试了git fetch origin [my branch name],然后尝试了git reset --hard FETCH_HEAD(在这里找到),但是我本地副本仍指向超旧提交.

我还尝试使用git checkout 1d5d525(解决方案

不确定这是否是正确的礼节,但即使我们帮助了@VonC和@AnimiVulpis,我仍然能够解决自己.

使用git branch -a -vv表明本地和远程分支都指向同一提交,但是该提交是错误的(该提交是8个月前的).

我将存储库克隆到一个新文件夹中,登录到Bitbucket以获取最新的提交哈希,并使用git reset --hard [commit hash]将HEAD指向正确的提交.

现在一切似乎都工作正常(尽管在不同的目录中大声笑).我不确定远程分支最终如何指向该提交,但是很高兴问题得以解决.

感谢@VonC和@AnimiVulpis抽出宝贵的时间来提供帮助.

Somehow my local branch is stuck 8 months behind my remote branch.

When I do git pull origin [my branch name] it says Already up to date.

I tried git fetch origin [my branch name] then git reset --hard FETCH_HEAD (found here) but my local copy is still pointing to the super old commit.

I've also tried resetting to the specific by using git checkout 1d5d525 (found here) but it says: error: pathspec '1d5d525' did not match any file(s) known to git. but that commit is 100% in the remote branch because I can see it in BitBucket.

The only thing I can think of that I've done any differently was that yesterday I worked on a different machine (my OSX laptop, rather than my Win10 desktop) but that doesn't explain why it's 8 months behind.

If any gurus could give me some guidance, that would be awesome.

NOTE: I can commit more changes from my laptop and they show up on my branch in BitBucket, but still no luck.

NOTE: I'm the only person that works on this branch in case that info is important.

Thanks!

EDIT:

Here is the output for git branch -vv and git remote - v as requested.

$ git branch -vv
ImageEdit 39b733c Image editing tweaks
Widgets   cce09e8 Merge Globals + Widgets to use the same functionality / DB table
* john      11798f3 [origin/john] Finished PDF Header. Waiting for feedback...
master    cce09e8 Merge Globals + Widgets to use the same functionality / DB table

$ git remote - v
origin  git@bitbucket.org:johnt/website.git (fetch)
origin  git@bitbucket.org:johnt/website.git (push)

NOTE: I'll point out that the master branch also seems to be way behind the remote based on the above commit message.

EDIT 2:

Here is the output for git branch -a -vv

$ git branch -a -vv
ImageEdit                39b733c Image editing tweaks
Widgets                  cce09e8 Merge Globals + Widgets to use the same functionality / DB table
* john                   11798f3 [origin/john] Finished PDF Header. Waaiting for feedback...
master                   cce09e8 Merge Globals + Widgets to use the same functionality / DB table
remotes/origin/ImageEdit 39b733c Image editing tweaks
remotes/origin/Widgets   cce09e8 Merge Globals + Widgets to use the same functionality / DB table
remotes/origin/glenn     0548f0d Changed Create a Lifeshare Page to Create a Lifeshare
remotes/origin/john      11798f3 Finished PDF Header. Waiting for feedback...
remotes/origin/master    cce09e8 Merge Globals + Widgets to use the same functionality / DB table

解决方案

Not sure if this is the correct etiquette but I was able to resolve myself even though @VonC and @AnimiVulpis we helping out.

Using git branch -a -vv showed that both local and remote branches were pointing to the same commit, but that commit was wrong (that commit was from 8 months ago).

I cloned the repository into a new folder, logged into Bitbucket to get the latest commit hash and used git reset --hard [commit hash] to point the HEAD to the correct commit.

Now everything seems to be working fine (although in a different directory lol). I'm not sure how the remote branch ended up pointing to that commit, but glad the issue is resolved.

Thanks to both @VonC and @AnimiVulpis for taking time to help.

这篇关于GIT不会从远程获取最新更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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