1

I'm trying to merge a branch of a repository a developer I'm working with committed. There are some conflicts with the master branch.

$ 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.

but I know the conflicts that cannot be merged are all generated files and I shouldn't worry about them, bin, lock files. They're not config or code files.

Is there a way I could tell git to ignore all, not going through every directory and specify *.bin, *.lock ??

naim5am
  • 1,334
  • 3
  • 17
  • 33
  • Why is `.gradle` in your repository at *all*? Anyway: https://stackoverflow.com/q/16550688/438992, https://www.quora.com/Does-gitignore-file-only-work-on-current-folder, and so on. The web is your friend. – Dave Newton May 08 '19 at 19:14
  • Your top level `.gitignore` should have `**/android/.gradle` in it – Richard Heap May 08 '19 at 19:15
  • First, you could try to merge as follow: `git checkout master`, `git pull`, `git checkout your_branch_name`, `git merge --no-ff master` and then solve the conflicts. Second, you need to provide an editor to your git unless you are planning to use your IDE. Here is an example on how to setup the editor `$ git config --global core.editor emacs` where in this case, we are setting emacs as your editor if you happen to have it. – acarlstein May 08 '19 at 19:52

1 Answers1

1

If they are generated files from the source, 2 things:

  • First, generate them from the source of the merge (prior to commit) and that should take care of "conflicts" on them
  • But second and more important: files that are generated from the source of the project shouldn't be tracked at all.
eftshift0
  • 26,375
  • 3
  • 36
  • 60