How to mass-resolve Git Conflicts with only File Mode changes?

I am trying to merge two repositories, and there are only a couple of “real” conflicts, but there are about 70 file conflicts of “Both added”. When viewing a git diff, however, it only shows file mode changed.

What would be the best way to mass-accept the current file mode and ignore the incoming file mode?

  • git `merge --squash` does not add “Merge” header to commit
  • “log out” from old github account and use other one for smartgit
  • How should I organize my Git repositories and branches to create multiple versions of a website?
  • How to add (ssh) key to IBM Bluemix DevOps Services' git repository?
  • Have Jenkins (Cloudbees) only build on change in specific branch
  • Another git process seems to be running and thus cant commit
  • A little background:
    These 2 repositories are of the same code, but one has been tracked through SVN, so doesn’t have a history. I’m using git-svn to track it now and merge it with the current git repository.

    The incoming conflicts on merge appear as:
    CONFLICT (add/add): Merge conflict in framework/file/name.php
    Automatic merge failed; fix conflicts and then commit the result.

    Git status shows:
    both added: framework/file/name.php

    If I use the git mergetool, it does not show any conflicts. Going through each file using this method takes a very long time.

  • Github for Windows ignoring .gitignore file
  • How to stop Visual Studio from closing the solution when changing the active Git repo
  • Is there any reason to not set 'git fetch' to always use the --prune option?
  • Git: maintaining many topic branches on a frequently-moving base
  • Git merge driver problem
  • Git push all commits as single commit with custom message
  • 2 Solutions collect form web for “How to mass-resolve Git Conflicts with only File Mode changes?”

    So after trying all the various merge strategies, and determining that I needed to take the file mode from the repository, discarding the local file mode, the best solution I came up was to use:
    git checkout --theirs <remote/branch> -- path for the filemode changes, and used git mergetool for the code conflict resolution.
    Using git diff, I could see which files were filemode changes, and which were file code changes.
    git merge uses --recursive -Xours as the default merge strategy.

    There is a git config variable: core.fileMode that can ignore file mode changes.
    See: How do I make Git ignore file mode (chmod) changes?

    How about git merge -Xours branchToMergeIn? It will merge the two and give preference to your current branch. Never tried it with mode changes, but should do the trick…

    edited with jeffromi’s merge strategy.

    Git Baby is a git and github fan, let's start git clone.