在git的2个不同分支中合并2个具有相同名称的文件 [英] Merging 2 files with the same name in 2 different branches in git

查看:667
本文介绍了在git的2个不同分支中合并2个具有相同名称的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前在从master创建的名为branch1的分支中有一个名为test1的文件,在从master创建的名为branch2的分支中又有一个名为test1的文件. 如果我将2个分支合并到master中,两个文件中写入的代码会怎样?

I currently have a file named test1 in a branch named branch1 created from master and another file also named test1 in a branch named branch2 also created from master. What's gonna happen to the code written in both files if I merge the 2 branches in master?

推荐答案

步骤可能会做到:

  1. branch1合并到master.

应该会顺利进行.

master合并到branch2.

在这里您可能会遇到合并冲突.解决它.

Here you will probably get a merge conflict. Resolve it.

branch2合并到master.

这将确保即使您犯了一些错误,您的母版也不会受到污染",分支上会出现错误,并且会得到解决.

This will make sure your master is never "poluted" even if you made some mistakes , there would be on branches, and would be resolved.

这篇关于在git的2个不同分支中合并2个具有相同名称的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆