You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

本地代码与origin/main存在差异,但Git显示已同步?求助

本地代码与origin/main存在差异但Git显示已同步的问题

我知道这类问题很多,已经查过尽可能多的相关问题并试过各种修复方法,都没用。

之前推送项目时遇到合并冲突,用Visual Studio工具解决后完成推送,但现在本地项目代码和origin/main上的代码有明显差异。

执行Git命令的输出如下:

PS C:\app> git pull
Already up to date.
PS C:\app> git status
On branch main
Your branch is up to date with 'origin/main'.

nothing to commit, working tree clean
PS C:\app> git add .
PS C:\app> git commit -m "am I commting anythin?"
On branch main
Your branch is up to date with 'origin/main'.

nothing to commit, working tree clean

我查了当前提交哈希,和远程仓库最新提交哈希一致:

PS C:\app> git rev-parse HEAD
0a9a00176fc39a7417e44051d4df74785e4dae7d

尝试排查的操作:

  • 执行git branch -vv显示本地main分支与远程origin/main指向同一提交:
    PS C:\app> git branch -vv
    * main 0a9a001 [origin/main] adding simple one id get
    
  • 重新设置上游分支:
    PS C:\app> git branch --set-upstream-to origin/main
    branch 'main' set up to track 'origin/main'.
    
  • 执行git remote show origin查看远程信息,未发现异常:
    PS C:\app> git remote show origin
    * remote origin
      Fetch URL: https://site/_git/minetilbud-ntplus-customer-migration
      Push  URL: https://site/_git/minetilbud-ntplus-customer-migration
      HEAD branch: main
      Remote branch:
        main tracked
      Local branch configured for 'git pull':
        main merges with remote main
      Local ref configured for 'git push':
        main pushes to main (up to date)
    

所有操作都没解决问题,求帮助。

内容的提问来源于stack exchange,提问作者penstiaGarse

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.15 08:45:51