当前位置:网站首页>传智教育 | 多人协作开发出现代码冲突,如何合并代码?
传智教育 | 多人协作开发出现代码冲突,如何合并代码?
2022-06-23 06:36:00 【传智教育】
1.解决思路
其实解决思路就是小智(程序员A)在提交自己修改的代码之前重新拉取下远程服务器的代码也就是小黑(程序员B)新新修改的代码,然后小智选择性进行合并和废弃代码,然后将修改的后的代码重新commit并推送到远程服务器端。

2.动手实践
制造冲突:假设小黑将自己修改的代码推送到远程服务器上,这里我们在远程服务器上直接修改。

2.1基于Idea工具解决
【1】小智在idea中进行拉取


【2】这时候弹出窗口,需要手动进行合并



【3】先commit

【4】然后提交到远程仓库


【5】远程仓库结果

2.2基于Git命令解决
【1】克隆项目

【2】制造冲突
假设小黑将自己修改的代码推送到远程服务器上,这里我们在远程服务器上直接修改。

【3】小智拉取到本地

【4】查看冲突文件

【5】解决冲突
1.手动修改冲突文件,实际开发中当修改完冲突之后需要通知他人。

2.将修改的内容进行添加、提交、推送

3.远程服务器效果
边栏推荐
- Regular expression graph and text ultra detailed summary without rote memorization (Part 1)
- Nacos adapts to oracle11g- modify the source code of Nacos
- codeforce 158B Taxi
- MySQL (11) - sorting out MySQL interview questions
- 295. median data flow
- Nacos适配oracle11g-建表ddl语句
- [system] right click the desktop icon. After turning around, the Explorer will crash and the desktop will be refreshed
- 309. the best time to buy and sell stocks includes the freezing period
- SSM integration
- 对二进制的某一位操作
猜你喜欢
随机推荐
How flannel works
897. incremental sequential search tree
313. super ugly number
315. calculate the number of elements on the right that are smaller than the current element
307. area and retrieval - array modifiable
Spock sub piling
都是硬盘分区 C盘和D盘到底有什么区别?
【博弈论】基础知识
codeforce 158B Taxi
控制台程序
Pagoda forgot password
C language learning summary
Technical article writing guide
启发式的搜索策略
Spock-sub打桩
MySQL(四) — MySQL存储引擎
junit单元测试报错org.junit.runners.model.InvalidTestClassError: Invalid test class ‘xxx‘ .No runnable meth
316. remove duplicate letters
Page embedded iframe click browser back problem
Tp6+redis+think-queue+supervisor implements the process resident message queue /job task









