How to merge conflicted file in your branch only in git?

I have two branches branch-A and Integration. When I create pull request for Integration branch I see conflicts in one file. I don’t want to merge whole branch to resolve conflicts, I just want that conflicted file to be merged into branch-A and resolve the conflicts.

Is there any way that I can just merge that conflicted file ONLY to branch-A from Integration branch?

  • Which SCM can comfortably handle 90,000 files
  • Git merging hotfix branch into feature branch, then removing hotfix branch?
  • Extract relevant changes for code review
  • Help in understanding SVN Externals
  • Where should you store 3rd party assemblies?
  • Performing a git pull in pure PHP
  • Version Controlling Database that is used by multiple projects
  • In IntelliJ IDEA, how to add the same file to multiple version control systems?
  • One Solution collect form web for “How to merge conflicted file in your branch only in git?”

    I’m not sure if merging only one file is a good idea, but If you really want to do that, just create patch with changes to this file and apply it on branch-A:

    1. Checkout branch-A:

      $ git checkout branch-A
    2. Create patch:

      $ git format-patch branch-A..Integration <file_path> --stdout > changes.patch
    3. Apply it:

      $ git am --3way < changes.patch
    4. Applying patch will stop because conflict, resolve it and resume applying:

      $ git add <file_path>
      $ git am --continue
    Git Baby is a git and github fan, let's start git clone.