Konrads
Konrads

Reputation: 2284

How to sync git remotes

I managed to mess up my remotes and would like to get back in sync with origin. I have previously deleted all remotes and have manually re-added them.

My remotes are:

$ git remote -v show
origin  https://github.com/rapid7/metasploit-framework (fetch)
origin  https://github.com/rapid7/metasploit-framework (push)
truekonrads     git@github.com:truekonrads/mriv-metasploit.git (fetch)
truekonrads     git@github.com:truekonrads/mriv-metasploit.git (push)

I would like to update origin/master to latest version and then merge truekonrads/mirv-events branch into master. How do I do it?

is it possible to do it in a fashion that github keeps track of origin?

Upvotes: 1

Views: 299

Answers (1)

twalberg
twalberg

Reputation: 62499

To "update origin/master to latest version":

git fetch origin master

To "merge truekonrads/mirv-events branch into master":

git checkout master
git merge truekonrads/mirv-events

Not sure what you mean by github keeping track of origin. Your local repository is keeping track of origin. You could git remote add github <URL>; git push github origin/master:latest_origin_master to push a copy of origin/master up to github for safekeeping under the name latest_origin_master, but it's not clear if that's what you're wanting, especially since both origin and truekonrads are already on github.

Given your output above, it seems that origin and truekonrads are defined identically, which is redundant.

Upvotes: 1

Related Questions