0

There's git pull -all to pull all branches from maybe all remotes (?) or just the origin, but if I have another remote called spaceship, how can I pull all branches just from this remote?

These are my attempts:

C:\DATA\Git\Repo>git pull --all spaceship
fatal: fetch --all does not take a repository argument

C:\DATA\Git\Repo>git pull spaceship --all
fatal: fetch --all does not take a repository argument

I've tried looking on SO but like all Git-related questions, 134 answers come back with 29 comments each and some guy going on for 2 pages about how Git works internally. Please, succinctly, what do I type in?

Thanks.

Luke Puplett
  • 42,091
  • 47
  • 181
  • 266
  • 2
    possible duplicate of [Can "git pull --all" update all my local branches?](http://stackoverflow.com/questions/4318161/can-git-pull-all-update-all-my-local-branches) – Anshul Goyal Nov 21 '14 at 13:25
  • Perfect, thanks. Now, I assume I should not delete this question? – Luke Puplett Nov 21 '14 at 13:58
  • If your query has been completely answered and you agree it is a duplicate, sure, go ahead and delete it. – Anshul Goyal Nov 21 '14 at 13:59
  • Based on your comments below I think you have fallen into a common git misconception. You don't ever need, nor do you want, to have local refs for all the branches updated. The remote refs track all the info there is, or you can use a bare mirror clone. – Andrew C Nov 21 '14 at 17:39

1 Answers1

0

You can run git fetch which will get all branches on your remote and then you can switch to those branches with git checkout branch

DrRoach
  • 1,320
  • 9
  • 16
  • I don't think this will auto-merge the branches in. – Luke Puplett Nov 21 '14 at 12:38
  • They are, all branches are pulled in they just aren't shown until you checkout each branch – DrRoach Nov 21 '14 at 12:42
  • Okay, then the problem is that I'm not going to be checking out the branches. It's an automated cronjob to pull a backup from a remote. – Luke Puplett Nov 21 '14 at 12:44
  • The whole point of git is that you never need to create backups again as git keeps a record of every change that you make... – DrRoach Nov 21 '14 at 12:45
  • 1
    Honestly, please, it annoys me when people on SO begin guessing at someone else's situation. A situation has arisen where management want to ensure there's a copy of a repo on our infrastructure. – Luke Puplett Nov 21 '14 at 12:58
  • Also my answer will still work as the place you ran git fetch from will have the old version of your code even if you push again from a different place – DrRoach Nov 21 '14 at 13:00
  • I'm not guessing at your situation I'm just telling you at no point what so ever should you need a backup of a git repo – DrRoach Nov 21 '14 at 13:23
  • You're showing your age. You'll find when you work in large companies, with many people, that life is not so simple. – Luke Puplett Nov 21 '14 at 17:00
  • To be quite honest that is one of the most narrow minded things anyone has ever said. There are millions of young developers who have worked and do work in massive companies and I myself have worked on projects such as driveclub so don't be such a pompous t**t. Like I said, I have worked on massive projects and never has the situation aroused where we had to make a back up of git BECAUSE THAT IS WHAT GIT DOES. IT IS A VERSION CONTROL SYSTEM. – DrRoach Nov 21 '14 at 18:52