Q:

How to merge two git repos - local and remote?

I started developing some code at my laptop, so I executed git init and then made some commits. After that I even created branch on my local repo. I didn't expect that my colleague in the meantime will push some his work to remote repo I was planning to push my code (it was empty). What is the easiest way to merge those two repos into one?

A:

What you need to do is the following.
Do a git pull <remote_name> master so that you have the changes of the remote branch to which your colleague has pushed. This will fetch all the changes from the remote and merge them into your local current branch. You can now push to remote your current branch. Assuming you are on master, you would do this
git push <remote_name> master or whatever the name of your local branch is. This should be it unless there are any merge conflicts with your colleague's or any other pushes. If there are any merge conflicts you need to resolve them before you can push your changes.

