git rebase时候出现冲突问题

上面一篇文章写了git rebase 如何操作https://blog.csdn.net/weixin_43978695/article/details/104955182,但是,有时候我们代码可能会出现冲突,怎么解决呢?
出现的问题:
git rebase -i master
Auto-merging APP-META/docker-config/Dockerfile_testing
CONFLICT (content): Merge conflict in APP-META/docker-config/Dockerfile_testing
Auto-merging APP-META/docker-config/Dockerfile_staging
CONFLICT (content): Merge conflict in APP-META/docker-config/Dockerfile_staging
Auto-merging APP-META/docker-config/Dockerfile_production
CONFLICT (content): Merge conflict in APP-META/docker-config/Dockerfile_production
error: could not apply 1479a8f5… update base image
Resolve all conflicts manually, mark them as resolved with
“git add/rm <conflicted_files>”, then run “git rebase --continue”.
You can instead skip this commit: run “git rebase --skip”.
To abort and get back to the state before “git rebase”, run “git rebase --abort”.
Could not apply 1479a8f5… update base image
解决方案:
1.先 git rebase --abort
2.先 git status 查看一下状态,对有有冲突的文件,先修改一下,修改完之后,
(APP-META/docker-config/Dockerfile_production 这个是需要修改的文件)
2.$ git diff APP-META/docker-config/Dockerfile_production
3.git add APP-META/docker-config/Dockerfile_testing
4. git rebase --continue
5. esc :wq
6. 如果还有问题,继续上面查看status,修改文件,git diff 文件,git add 文件, git rebase --continue esc :wq,直到没有冲突为止
7.git push -f origin 我的当前分支

完美解决!

补充:如果是前端代码,可能在rebase之后会出现如下问题:
在这里插入图片描述
解决方案:重新checkout一下,还原文件,继续 rebase 就可以了。

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值