VS团队资源管理器无法同步,错误为:无法拉取,因为本地和远程分支已更改


勇哥今天用vs团队资源管理器“同步”时出现一个不一样的错误。


错误如下:


image.png


vs的输出窗口报告的完整信息如下:

已在存储库 D:\xxxx 中本地创建提交 e76d4178
Remote: Enumerating objects: 43, done.        
Remote: Counting objects:   2% (1/43)        
Remote: Counting objects:   4% (2/43)        
Remote: Counting objects:   6% (3/43)        
Remote: Counting objects:   9% (4/43)        
Remote: Counting objects:  11% (5/43)        
Remote: Counting objects:  13% (6/43)        
Remote: Counting objects:  16% (7/43)        
Remote: Counting objects:  18% (8/43)        
Remote: Counting objects:  20% (9/43)        
Remote: Counting objects:  23% (10/43)        
Remote: Counting objects:  25% (11/43)        
Remote: Counting objects:  27% (12/43)        
Remote: Counting objects:  30% (13/43)        
Remote: Counting objects:  32% (14/43)        
Remote: Counting objects:  34% (15/43)        
Remote: Counting objects:  37% (16/43)        
Remote: Counting objects:  39% (17/43)        
Remote: Counting objects:  41% (18/43)        
Remote: Counting objects:  44% (19/43)        
Remote: Counting objects:  46% (20/43)        
Remote: Counting objects:  48% (21/43)        
Remote: Counting objects:  51% (22/43)        
Remote: Counting objects:  53% (23/43)        
Remote: Counting objects:  55% (24/43)        
Remote: Counting objects:  58% (25/43)        
Remote: Counting objects:  60% (26/43)        
Remote: Counting objects:  62% (27/43)        
Remote: Counting objects:  65% (28/43)        
Remote: Counting objects:  67% (29/43)        
Remote: Counting objects:  69% (30/43)        
Remote: Counting objects:  72% (31/43)        
Remote: Counting objects:  74% (32/43)        
Remote: Counting objects:  76% (33/43)        
Remote: Counting objects:  79% (34/43)        
Remote: Counting objects:  81% (35/43)        
Remote: Counting objects:  83% (36/43)        
Remote: Counting objects:  86% (37/43)        
Remote: Counting objects:  88% (38/43)        
Remote: Counting objects:  90% (39/43)        
Remote: Counting objects:  93% (40/43)        
Remote: Counting objects:  95% (41/43)        
Remote: Counting objects:  97% (42/43)        
Remote: Counting objects: 100% (43/43)        
Remote: Counting objects: 100% (43/43), done.        
Remote: Compressing objects:   4% (1/25)        
Remote: Compressing objects:   8% (2/25)        
Remote: Compressing objects:  12% (3/25)        
Remote: Compressing objects:  16% (4/25)        
Remote: Compressing objects:  20% (5/25)        
Remote: Compressing objects:  24% (6/25)        
Remote: Compressing objects:  28% (7/25)        
Remote: Compressing objects:  32% (8/25)        
Remote: Compressing objects:  36% (9/25)        
Remote: Compressing objects:  40% (10/25)        
Remote: Compressing objects:  44% (11/25)        
Remote: Compressing objects:  48% (12/25)        
Remote: Compressing objects:  52% (13/25)        
Remote: Compressing objects:  56% (14/25)        
Remote: Compressing objects:  60% (15/25)        
Remote: Compressing objects:  64% (16/25)        
Remote: Compressing objects:  68% (17/25)        
Remote: Compressing objects:  72% (18/25)        
Remote: Compressing objects:  76% (19/25)        
Remote: Compressing objects:  80% (20/25)        
Remote: Compressing objects:  84% (21/25)        
Remote: Compressing objects:  88% (22/25)        
Remote: Compressing objects:  92% (23/25)        
Remote: Compressing objects:  96% (24/25)        
Remote: Compressing objects: 100% (25/25)        
Remote: Compressing objects: 100% (25/25), done.        
Remote: Total 32 (delta 22), reused 0 (delta 0), pack-reused 0        
Hint: You have divergent branches and need to specify how to reconcile them.
Hint: You can do so by running one of the following commands sometime before
Hint: your next pull:
Hint: 
Hint:   git config pull.rebase false  # merge
Hint:   git config pull.rebase true   # rebase
Hint:   git config pull.ff only       # fast-forward only
Hint: 
Hint: You can replace "git config" with "git config --global" to set a default
Hint: preference for all repositories. You can also pass --rebase, --no-rebase,
Hint: or --ff-only on the command line to override the configured default per
Hint: invocation.
无法拉取,因为本地和远程分支已更改。
请为如何在 Git 设置中协调不同分支设置首选 Git 行为。


团队资源管理器的内容如下:

image.png


分支历史记录树如下:

image.png



这个问题的解决办法是变基

首先“管理分支”

image.png

选中remotes/origin下的devLxy

然后右键菜单“变基到”

出现下图的变基面板。

image.png

点“变基”,然后再“同步”即可。



有关“变基”的理解,下面这文章讲得非常清楚:

https://blog.csdn.net/weixin_42310154/article/details/119004977




本文出自勇哥的网站《少有人走的路》wwww.skcircle.com,转载请注明出处!讨论可扫码加群:
本帖最后由 勇哥,很想停止 于 2023-06-12 17:33:29 编辑

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

会员中心
搜索
«    2025年4月    »
123456
78910111213
14151617181920
21222324252627
282930
网站分类
标签列表
最新留言
    热门文章 | 热评文章 | 随机文章
文章归档
友情链接
  • 订阅本站的 RSS 2.0 新闻聚合
  • 扫描加本站机器视觉QQ群,验证答案为:halcon勇哥的机器视觉
  • 点击查阅微信群二维码
  • 扫描加勇哥的非标自动化群,验证答案:C#/C++/VB勇哥的非标自动化群
  • 扫描加站长微信:站长微信:abc496103864
  • 扫描加站长QQ:
  • 扫描赞赏本站:
  • 留言板:

Powered By Z-BlogPHP 1.7.2

Copyright Your skcircle.com Rights Reserved.

鄂ICP备18008319号


站长QQ:496103864 微信:abc496103864