[英]Resolve Conflicts Between Two Branches
I'm working on an application and managing its repo on bitbucket. 我正在开发一个应用程序,并在bitbucket上管理其回购。
During the development process, I created a new branch 'price-module' a few days ago and pushed its changes in the remote branch by the same name. 在开发过程中,几天前我创建了一个新的分支“价格模块”,并将其更改以相同的名称推送到远程分支中。 Now, when I'm merging 'price-module' to 'master' branch, bitbucket is showing me an error that there are conflicts between some files.
现在,当我将“价格模块”合并到“主”分支时,bitbucket向我显示一个错误,指出某些文件之间存在冲突。 (specifically in bin/R.txt).
(特别是在bin / R.txt中)。 How can I resolve these conflicts and merge the changes I did in 'price-module' to 'master' branch without losing my code?
如何解决这些冲突,并将在“价格模块”中所做的更改合并到“主”分支中而又不会丢失代码?
PS: the project I'm working on is an Android project. PS:我正在处理的项目是一个Android项目。
Update: what have I tried so far to solve the problem 更新:到目前为止,我已尝试解决该问题的方法
I did some research on my own to try and solve the conflict between files. 我自己进行了一些研究,以尝试解决文件之间的冲突。 These are the steps I took to solve the conflict:
这些是我为解决冲突而采取的步骤:
gen
or bin
), pushed them to master and then tried to merge 'price-module' into 'master' -- FAILED! gen
或bin
)复制它们来手动覆盖冲突的文件,将它们推送到master,然后尝试将'price-module'合并为'master'-FAILED ! exclude
file in my .git
folder from this answer but the gen
and bin
folders kept showing up. .git
文件夹中的exclude
文件中添加了特定于Android的规则,但gen
和bin
文件夹一直显示。 In an Android project, you should not be storing the bin
folder in version control in the first place as it contains only generated files. 在Android项目中,首先不应将
bin
文件夹存储在版本控制中,因为它仅包含生成的文件。 Though R.txt
isn't one of them, there's R.java
in gen/your/package/name
. 尽管
R.txt
不是其中之一,但是gen/your/package/name
有R.java
。
Assuming it's the generated bin
folder, you should remove it from git, add it to .gitignore
so it doesn't show up as non-versioned in git status, merge or re-apply the deletion to both branches, and just let the build tools generate bin
files as needed. 假设它是生成的
bin
文件夹,则应将其从git中删除,将其添加到.gitignore
这样它就不会在git状态下显示为非版本化,将删除合并或重新应用到这两个分支,然后让构建工具会根据需要生成bin
文件。
For more things to not put in version control, see Typical .gitignore file for an Android app 有关不要放入版本控制的更多信息,请参阅Android应用程序的典型.gitignore文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.