Software development can be a tedious process. Sometimes you can have multiple forks of the same project with different teams working on individual forks. But the need to incoporate good functionalities of one fork to another can lead to merging one git repository to another which can be a headache for the project lead.

The following steps can be followed in order to merge one git repository inside another.Let us consider fork_first and fork_second be the forks of the same project exixting in two git repositories.

First you have to be in a directory of the project where you want to merge another repository to. In our case , let us merge master branch of fork_second inside master branch of fork_first

$ cd /path/to/fork_first
$ git checkout master #switch to master branch(or any other branch to merge to)

Now the next step would be to add the remote url of fork_second

$ git remote add -f fork_second [email protected]:gituser/fork_second.git #git remote url

Now you can easily merge master of fork_second into fork_first

$ git merge fork_second/master