我正在开发分支中处理我的Android应用程序。我想要将我的更改合并到master中,我想我会使用回答here中建议的方法,在这里我将master合并到dev分支中,在实际掌握之前处理任何潜在问题。所以,我执行下面的命令,而在我的Dev分支:在我的Android应用程序的app/build/intermediate目录中获取大量合并冲突
git add .
- 加我的所有电流变化
git commit -m"My commit message
- 提交我的变化
git push origin devBranch
- 把我的改变最多的GitHub
git merge master
- 将我的主分支合并到开发分支中
这是当我遇到以下冲突时,我从来没有前EEN:
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 .
让自己陷入麻烦,但这是我一直这样做的方式,添加我更改的每个单独的文件似乎并不实际(并且我想要添加更改生成的文件,我不会?)。
我是否因为合并的方式而发生这些冲突?如果我切换到我的主分支,并将开发分支合并到主,我会有同样的问题?我害怕尝试这种方式,但这是我之前合并更改的方式,并且从来没有给我任何类似的问题。
这有一个难闻的气味。理想情况下,您的中间构建目标目录对Git甚至不可见。解决的办法是在'.git'文件夹中没有构建文件。 –
添加一个带'app/build /'行的'.gitignore'文件。你可以在这里找到一个很好的例子:https://github.com/github/gitignore/blob/master/Android.gitignore。添加完后,你可以'git rm'生成文件夹。构建产品几乎不应该受到源代码控制。 – jjm