Git pulling changes between two local repositories

Sirish picture Sirish · Apr 25, 2011 · Viewed 25.3k times · Source

I have two clones of same remote repository. I have made some changes to one local repository, how can I pull these changes to the other local repository without pushing it to the remote?

Answer

djs picture djs · Apr 25, 2011

You can treat the second clone the same way you treat a remote respository on another system. You can perform all of the same operations, e.g.

~/repo1 $ git remote add repo2 ~/repo2
~/repo1 $ git fetch repo2
~/repo1 $ git merge repo2/foo