即使在“push --force”之后,Git也显示出差异?

问题描述 投票:2回答:3

简化:

enter image description here

在我的master分店,我添加了一些垃圾。 然后我把它推到了原点/主人

后来我发现添加垃圾是个错误。我知道我可以/应该创建一个还原提交。

但我没有。我做了一个git reset --hard

enter image description here

但是现在我希望origin / master看起来和我的本地完全一样。

显然我不能推,因为git告诉我pull之前推。

所以我做了push --force

enter image description here

但即使在那之后,sourcetree也表明它们不一样:

enter image description here

即使我检查更改,我也看不到任何变化:

enter image description here

题:

如果远程master和本地master没有差异,为什么sourcetree会告诉我pull

enter image description here

甚至git status显示我很好(没有拉):

enter image description here

git atlassian-sourcetree
3个回答
1
投票

SourceTree会定期检查远程状态。

解决方案1:只需重新打开Sourcetree即可

解决方案2:工具>选项>常规检查每X分钟更新一次的默认遥控器。使X为1/2以更快地查看状态变化。与图像一样,您可以在1分钟后看到更新后的状态。

change remote update time

希望这会有所帮助。


1
投票

一般建议:每当包装CLI程序或库的GUI出现异常时,最好直接检查实际的CLI程序或库。


在这种情况下,运行一个fetch:

git fetch origin

然后检查分支指向的位置:

git log master origin/master

也许:

git branch --all --verbose

甚至:

git show master
git show origin/master

允许您检查分支实际指向哪个提交(哈希),从而确认(或不确定)GUI是否存在问题。

即使您确认SourceTree在重新打开时没有显示问题,我也会直接用Git仔细检查,以防万一。


1
投票

有时Sourcetree与您的本地存储库不同步。发生这种情况时,只需告诉Sourcetree使用F5(Windows)或⌘+ R(macOS)刷新其视图。

© www.soinside.com 2019 - 2024. All rights reserved.