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?

  • How to run post-receive hook on GitHub
  • Create string array from git status bash output
  • Git commit bash script
  • Guideline for managing multiple dependent projects
  • How to migrate gitorious to gitlab repositories
  • Ansible and Git Permission denied (publickey) at Git Clone
  • Git Pull Synchronization
  • Rollback changes for only one of commited files
  • git on command line using github git
  • git clone vs git pull
  • How to gitignore Go binaries?
  • Pulling my own private repository from Bitbucket via Composer
  • 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.