If you want to merge branch branchX
from projectA into projectB:
cd path/to/projectA
git checkout branchX
cd path/to/projectB
git remote add projectA /path/to/projectA
git fetch projectA --tags
git merge --allow-unrelated-histories projectA/branchX
git remote remove projectA
Thanks to this answer!