问题描述
以某种方式,我的本地分支机构比远程分支机构滞后了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
(),但它说:error: pathspec '1d5d525' did not match any file(s) known to git.
但该提交是远程分支中的100%,因为我可以在BitBucket中看到它.
我唯一能想到的是我做过任何不同的事情,就是昨天我在另一台机器上工作(我的OSX笔记本电脑,而不是Win10台式机),但这并不能解释为什么它落后了8个月./p>
如果有上师可以给我一些指导,那真是棒极了.
注意:我可以从笔记本电脑中提交更多更改,这些更改显示在BitBucket的分支中,但还是没有运气.
注意:如果信息很重要,那么我是唯一在此分支机构工作的人.
谢谢!
以下是git branch -vv
和git remote - v
的输出.
$ 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 [email protected]:johnt/website.git (fetch)
origin [email protected]:johnt/website.git (push)
注意:我要指出,基于上述提交消息,master分支似乎也位于远程后面.
这是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
不确定这是否是正确的礼节,但即使我们帮助了@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 [email protected]:johnt/website.git (fetch)
origin [email protected]: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不会从远程获取最新更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!