0

I have 2 repos: one is the official (where I pull off) and the second is customized (where I push to).

I've used the technique described here: Git push existing repo to a new and different remote repo server? to make the connections with these 2 repos.

Now I have a problem - I primary cloned the official repo from a branch, not from a master. Now, when the official branch has merged with the master on the remote repo, I want my local to pull from the master too, not from that branch.

How to do that?

My origin is called official (to pull off).

mimic
  • 4,897
  • 7
  • 54
  • 93
  • `checkout` to `master` and pull? – maazadeeb Jan 04 '19 at 03:43
  • try this https://git-scm.com/book/en/v2/Git-Branching-Remote-Branches – Amitkumar Karnik Jan 04 '19 at 03:43
  • @MaazSyedAdeeb how to do that taking into account my local repo is connected with 2 remotes? – mimic Jan 04 '19 at 03:47
  • Your question has a bunch of terminology issues: for instance, in Git, you cannot "clone from a branch". Git does not define *an* origin, but does use the word `origin` as the default first name for what Git calls a *remote*. A remote is, essentially, a short name for a URL. Whoever answers the "phone call" (the request for service) at that URL should be a Git repository, so a remote like `origin` is a short name for "how to call up another Git". Unfortunately, Git is full of specialized terminology, and to use it well, you'll need to memorize a lot of this kind of silliness... – torek Jan 04 '19 at 14:57
  • @torek Really? Wow https://stackoverflow.com/questions/1778088/how-do-i-clone-a-single-branch-in-git – mimic Jan 04 '19 at 20:11
  • That's cloning a specified branch *from* a *repository*, not "cloning from a branch". Had you said "ran `git clone --single-branch`", I could have pointed you to https://stackoverflow.com/questions/17714159/how-do-i-undo-a-single-branch-clone – torek Jan 04 '19 at 20:16
  • @torek everyone except you understood me. Of course, I clone from a repo, but there is no need to mention it because it's obvious. – mimic Jan 04 '19 at 20:32

1 Answers1

1

You could just checkout to master

git checkout master

Then, pull from the required remote, official in your case

git pull official master
maazadeeb
  • 5,922
  • 2
  • 27
  • 40
  • Exactly. As for a first command I did *git checkout -b master*, is that the same? Thanks!! – mimic Jan 04 '19 at 04:20
  • That's used to create a new branch named master. It's usually always present and will throw a fatal error. But in your case you cloned a non-master branch initially. So you'll need to create one. It should be fine. – maazadeeb Jan 04 '19 at 04:26
  • looks like I accidentally did what I had to :-0 – mimic Jan 04 '19 at 04:32