Git merge single file from another repository into my own

git, version-control

Solution

Try to add the `other-repo` then bring its branches including your `target-branch`

git remote add other git@github.com:username/other-repo.git
git fetch other

Switch to the branch you want to merge in the `target-file.ext`:

git checkout your-branch

Merge the target file into yours:

git checkout -p other/target-branch target-file.ext

Problem

Say I have my own git repo with a bunch of text files in it. There is another different git repo that someone else owns with a bunch of text files that all differ from my own except for one file. I am continuously making changes to the different text files in my repo, but every now and then I want to merge any changes of that single file from the other repo into my own. Is there any easy way of going about doing this? I've searched around and found some similar questions but none that we're for my exact scenario.

Original source