项目场景:
git代码合并了后发现有冲突,我们有时候不想解决冲突,不想合并了;或者别人把冲突解决完了,自己想拉取一下最新代码,咋办呢?文章来源:https://www.toymoban.com/news/detail-596993.html
解决方案:
使用命令行文章来源地址https://www.toymoban.com/news/detail-596993.html
git merge --abort
测试实现:
D:\cloud\ui-console (release/V3.4.1.1-20221122 -> origin)
λ git pull
remote: Enumerating objects: 7, done.
remote: Counting objects: 100% (7/7), done.
remote: Compressing objects: 100% (7/7), done.
remote: Total 7 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (7/7), done.
From http://gitlab.rd.cloud.com/cloud/pco/ui-console
31bb89ec..b010f16d release/V3.4.4-20221130 -> origin/release/V3.4.4-20221130
Already up to date.
D:\cloud\ui-console (release/V3.4.1.1-20221122 -> origin)
λ git checkout release/V3.4.4-20221130
Switched to a new branch 'release/V3.4.4-20221130'
M src/components/iam/logger/index.vue
Branch 'release/V3.4.4-20221130' set up to track remote branch 'release/V3.4.4-20221130' from 'origin'.
D:\cloud\ui-console (release/V3.4.4-20221130 -> origin)
λ git pull
Already up to date.
【将release/V3.4.1.1-20221122分支代码合到release/V3.4.4-20221130分支】
【合并过程有了冲突了】
D:\cloud\ui-console (release/V3.4.4-20221130 -> origin)
λ git merge release/V3.4.1.1-20221122 release/V3.4.4-20221130
Auto-merging src/components/workorder/orderDetail/components/order-detail-tab.vue
CONFLICT (content): Merge conflict in src/components/workorder/orderDetail/components/order-detail-tab.vue
Automatic merge failed; fix conflicts and then commit the result.
【别人提交的代码,自己不想解决冲突,让别人解决完冲突后自己拉取一下代码,发现有没有合并代码的错误】
D:\cloud\ui-console (release/V3.4.4-20221130 -> origin)
λ git pull
error: You have not concluded your merge (MERGE_HEAD exists).
hint: Please, commit your changes before merging.
fatal: Exiting because of unfinished merge.
D:\cloud\ui-console (release/V3.4.4-20221130 -> origin)
λ
【使用git merge --abort 取消合并】
D:\cloud\ui-console (release/V3.4.4-20221130 -> origin)
λ git merge --abort
【再进行git pull】
D:\cloud\ui-console (release/V3.4.4-20221130 -> origin)
λ git pull
Updating b010f16d..0ceb5fad
Fast-forward
src/components/expense/pay/openService.vue | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
D:\cloud\ui-console (release/V3.4.4-20221130 -> origin)
λ git pull
Already up to date.
到了这里,关于git代码合并了后发现有冲突,我们怎么取消合并?的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!