我正在开发分支中处理我的Android应用。我想要将我的更改合并到master中,我想我会使用答案here中建议的方法,我将master合并到dev分支中以处理任何潜在的问题实际上要掌握。所以我在开发分支中执行了以下命令:
git add .
- 添加我当前的所有更改
git commit -m"My commit message
- 提交我的更改
git push origin devBranch
- 将我的更改推送到github
git merge master
- 将我的主分支合并到开发分支
这时我遇到了以前从未见过的冲突:
warning: Cannot merge binary files: app/build/intermediates/res/resources-debug.ap_ (HEAD vs. master)
Auto-merging app/build/intermediates/res/resources-debug.ap_
CONFLICT (content): Merge conflict in app/build/intermediates/res/resources-debug.ap_
Auto-merging app/build/intermediates/incremental/mergeDebugResources/merger.xml
CONFLICT (content): Merge conflict in app/build/intermediates/incremental/mergeDebugResources/merger.xml
Auto-merging app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml
CONFLICT (add/add): Merge conflict in app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml
Auto-merging app/build/intermediates/incremental/mergeDebugResources/merged.dir/values-v17/values-v17.xml
CONFLICT (add/add): Merge conflict in app/build/intermediates/incremental/mergeDebugResources/merged.dir/values-v17/values-v17.xml
Auto-merging app/build/intermediates/incremental/mergeDebugResources/compile-file-map.properties
CONFLICT (content): Merge conflict in app/build/intermediates/incremental/mergeDebugResources/compile-file-map.properties
Auto-merging app/build/intermediates/incremental/mergeDebugAndroidTestResources/compile-file-map.properties
CONFLICT (content): Merge conflict in app/build/intermediates/incremental/mergeDebugAndroidTestResources/compile-file-map.properties
Auto-merging app/build/intermediates/blame/res/debug/single/layout.json
CONFLICT (content): Merge conflict in app/build/intermediates/blame/res/debug/single/layout.json
Auto-merging app/build/intermediates/blame/res/debug/single/drawable.json
CONFLICT (content): Merge conflict in app/build/intermediates/blame/res/debug/single/drawable.json
Auto-merging app/build/intermediates/blame/res/debug/single/drawable-xhdpi-v4.json
CONFLICT (content): Merge conflict in app/build/intermediates/blame/res/debug/single/drawable-xhdpi-v4.json
Auto-merging app/build/intermediates/blame/res/debug/single/drawable-hdpi-v4.json
CONFLICT (content): Merge conflict in app/build/intermediates/blame/res/debug/single/drawable-hdpi-v4.json
Auto-merging app/build/intermediates/blame/res/debug/multi/values.json
CONFLICT (content): Merge conflict in app/build/intermediates/blame/res/debug/multi/values.json
Automatic merge failed; fix conflicts and then commit the result.
我的问题是,我不知道如何修复这些冲突,因为它们位于我从未触及的中间文件中,我假设这是所有生成的代码。也许我通过git add .
让自己陷入困境,但这就是我一直这样做的方式,添加我改变的每个单独的文件看起来并不实用(而且我我想要添加更改的生成文件,不是吗?)。
由于我合并的方式,我是否遇到了这些冲突?如果我切换到我的主分支并将dev分支合并到master中,我会遇到同样的问题吗?我害怕尝试这个,但这是我之前合并变化的方式,从来没有给我任何类似的问题。
答案 0 :(得分:2)
像这样制作.gitignore
文件:
.idea
out
target
*.iml
log
local.properties
build
android/libs
/.gradle
提交它然后合并。