如何合并分支并忽略由flutter生成的二进制文件中的冲突?

时间:2019-05-08 19:11:54

标签: android git flutter

我正在尝试合并一个与我合作的开发人员提交的存储库分支。与master分支存在一些冲突。

$ git merge remotes/origin/master
warning: Cannot merge binary files: android/.gradle/buildOutputCleanup/outputFiles.bin (HEAD vs. remotes/origin/master)
warning: Cannot merge binary files: android/.gradle/buildOutputCleanup/buildOutputCleanup.lock (HEAD vs. remotes/origin/master)
warning: Cannot merge binary files: android/.gradle/4.4/taskHistory/taskHistory.lock (HEAD vs. remotes/origin/master)
warning: Cannot merge binary files: android/.gradle/4.4/taskHistory/taskHistory.bin (HEAD vs. remotes/origin/master)
warning: Cannot merge binary files: android/.gradle/4.4/javaCompile/taskJars.bin (HEAD vs. remotes/origin/master)
warning: Cannot merge binary files: android/.gradle/4.4/javaCompile/taskHistory.bin (HEAD vs. remotes/origin/master)
warning: Cannot merge binary files: android/.gradle/4.4/javaCompile/javaCompile.lock (HEAD vs. remotes/origin/master)
warning: Cannot merge binary files: android/.gradle/4.4/javaCompile/jarAnalysis.bin (HEAD vs. remotes/origin/master)
warning: Cannot merge binary files: android/.gradle/4.4/javaCompile/classAnalysis.bin (HEAD vs. remotes/origin/master)
warning: Cannot merge binary files: android/.gradle/4.4/fileHashes/resourceHashesCache.bin (HEAD vs. remotes/origin/master)
warning: Cannot merge binary files: android/.gradle/4.4/fileHashes/fileHashes.lock (HEAD vs. remotes/origin/master)
warning: Cannot merge binary files: android/.gradle/4.4/fileHashes/fileHashes.bin (HEAD vs. remotes/origin/master)
Auto-merging pubspec.yaml
Auto-merging lib/pages/qaView.dart
Auto-merging lib/firebase/firebaseManager.dart
Removing android/app/google-services.json
Auto-merging android/app/build.gradle
Auto-merging android/.gradle/buildOutputCleanup/outputFiles.bin
CONFLICT (content): Merge conflict in android/.gradle/buildOutputCleanup/outputFiles.bin
Auto-merging android/.gradle/buildOutputCleanup/buildOutputCleanup.lock
CONFLICT (content): Merge conflict in android/.gradle/buildOutputCleanup/buildOutputCleanup.lock
Auto-merging android/.gradle/4.4/taskHistory/taskHistory.lock
CONFLICT (content): Merge conflict in android/.gradle/4.4/taskHistory/taskHistory.lock
Auto-merging android/.gradle/4.4/taskHistory/taskHistory.bin
CONFLICT (content): Merge conflict in android/.gradle/4.4/taskHistory/taskHistory.bin
Auto-merging android/.gradle/4.4/javaCompile/taskJars.bin
CONFLICT (content): Merge conflict in android/.gradle/4.4/javaCompile/taskJars.bin
Auto-merging android/.gradle/4.4/javaCompile/taskHistory.bin
CONFLICT (content): Merge conflict in android/.gradle/4.4/javaCompile/taskHistory.bin
Auto-merging android/.gradle/4.4/javaCompile/javaCompile.lock
CONFLICT (content): Merge conflict in android/.gradle/4.4/javaCompile/javaCompile.lock
Auto-merging android/.gradle/4.4/javaCompile/jarAnalysis.bin
CONFLICT (content): Merge conflict in android/.gradle/4.4/javaCompile/jarAnalysis.bin
Auto-merging android/.gradle/4.4/javaCompile/classAnalysis.bin
CONFLICT (content): Merge conflict in android/.gradle/4.4/javaCompile/classAnalysis.bin
Auto-merging android/.gradle/4.4/fileHashes/resourceHashesCache.bin
CONFLICT (content): Merge conflict in android/.gradle/4.4/fileHashes/resourceHashesCache.bin
Auto-merging android/.gradle/4.4/fileHashes/fileHashes.lock
CONFLICT (content): Merge conflict in android/.gradle/4.4/fileHashes/fileHashes.lock
Auto-merging android/.gradle/4.4/fileHashes/fileHashes.bin
CONFLICT (content): Merge conflict in android/.gradle/4.4/fileHashes/fileHashes.bin
Auto-merging .packages
CONFLICT (content): Merge conflict in .packages
Auto-merging .flutter-plugins
CONFLICT (content): Merge conflict in .flutter-plugins
Automatic merge failed; fix conflicts and then commit the result.

但是我知道所有无法合并的冲突都是生成的文件, bin,lock 文件也不用担心。它们不是配置文件或代码文件。

有没有办法让git忽略所有内容,而不是遍历每个目录并指定 *。bin,*。lock ??

1 个答案:

答案 0 :(得分:1)

如果它们是从源代码生成的文件,则有两件事:

  • 首先,从合并源(提交之前)生成它们,并且应该解决它们上的“冲突”
  • 但是更重要的是:根本不应该跟踪从项目源生成的文件。。