当前位置:   article > 正文

git rebase时候出现冲突问题_rebase failed: rebase locally, resolve all conflic

rebase failed: rebase locally, resolve all conflicts, then push the branch.

上面一篇文章写了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 就可以了。

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号