Your branch and ‘origin/master‘ have diverged,and have 1 and 353 different commits each, respective

今天打开以前的一个项目,其他同事在维护,自己想更新下最新代码,然后执行拉取了下,竟然报错了:

git pull origin master

From ssh://test.com:1198/~test/test
 * branch            master     -> FETCH_HEAD
Auto-merging pom.xml
CONFLICT (content): Merge conflict in pom.xml
Auto-merging test-parent/pom.xml
CONFLICT (content): Merge conflict in test-parent/pom.xml
Removing test-stu/.gitignore
Auto-merging test-core/pom.xml
CONFLICT (content): Merge conflict in test-core/pom.xml
Automatic merge failed; fix conflicts and then commit the result.

然后clean了下:git clean -f   

再次拉取依然报错

接着按照提示:git merge --abort  

报错信息依旧

然后,查看了下状态

git status
On branch master
Your branch and 'origin/master' have diverged,
and have 1 and 353 different commits each, respectively.
  (use "git pull" to merge the remote branch into yours)

nothing to commit, working tree clean

由于之前本地修改过代码并提交过,且服务器上代码重构优化变动非常大,不想花时间处理冲突了,果断还原,还原方式如下:

1、> git rebase origin/master
   Successfully rebased and updated refs/heads/master.

2、git pull --rebase
    remote: Enumerating objects: 402, done.
    remote: Counting objects: 100% (348/348), done.
    remote: Compressing objects: 100% (187/187), done.
    remote: Total 210 (delta 91), reused 0 (delta 0)
    Receiving objects: 100% (210/210), 20.74 KiB | 558.00 KiB/s, done.
    Resolving deltas: 100% (91/91), completed with 28 local objects.
    From ssh://test:1198/~test/test
     * [new branch]      10.0.1.1         -> origin/10.0.1.1 
     * [new branch]      8.6.1.1           -> origin/8.6.1.1 
     * [new tag]         10.0.0.1          -> 10.0.0.1 
     * [new tag]         5.0.2.1           -> 5.0.2.1 
    Already up to date.

3、>git push origin master
   Everything up-to-date


4、>git status
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值