Git:从裸露的USB遥控器中拉出所有东西 [英] Git: Pull everything from bare usb remote

查看:66
本文介绍了Git:从裸露的USB遥控器中拉出所有东西的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试将usb-hdd设置为所有本地存储库的移动版本.我使用的所有内容都不在线,目前尚未共享.因此,唯一的合作者是我. 因此,目标是保存我的整个进度,并将其从其他计算机上的usb克隆.重要的是,所有标签,尤其是分支也被推入,拉出.而且我真的不想手动为每个分支做某事. 现在,我使用

I try to set up a usb-hdd to be my mobile version of all my local repos. Everything I use is not online and by now not shared. So the only collaborator is me. So the goal is to save my whole progress and clone it from the usb on some other machine. The important part is, that all the tags and especially branches are pushed, pulled aswell. And I don't really want to do something for each branch manually. By now I cloned my repos using

$ cd /Volumes/usb
$ git clone --mirror /path/to/working/repo

现在,我想从该裸露(据我所知镜像意味着裸露)回购中提取所有内容. 因此,我转到另一台机器/文件夹并进行

and now I want to pull everything from that bare (as far as I know mirror implies bare) repo. So I go to another machine/folder and do a

$ git clone file:///Volumes/usb/repo.git

并且master分支在本地克隆,我得到一个工作目录.但是,所有其他分支都位于远程(裸露的USB存储库)上,不会被拉出. 如果我使用git branch -r,我可以在遥控器上看到所有它们,但是拉动没有任何作用.

and the master branch is cloned locally and I get a working directory. All the other branches however are just on the remote (the bare usb repo) and don't get pulled. If I use git branch -r I can see all of them on the remote, but pulling doesn't do anything.

$ git br -a
* devel
  remotes/origin/HEAD -> origin/devel
  remotes/origin/devel
  remotes/origin/master

$ git pull origin master
From /test/repo
* branch            master     -> FETCH_HEAD
Already up-to-date.
$ git br -a
* devel
  remotes/origin/HEAD -> origin/devel
  remotes/origin/devel
  remotes/origin/master

没有任何更改,也没有建立本地分支.重点甚至是将所有远程分支机构设置为本地分支机构.我真的想从我离开的地方开始.

Nothing changed and it doesn't set up a local branch. The whole point would even be to set up all remote branches as local branches. I really want to start, where I left off.

推荐答案

所有其他分支都位于远程(裸露的USB存储库)上,不会被拉走

All the other branches however are just on the remote (the bare usb repo) and don't get pulled

他们被拉了.
您会看到它们,而不是在远程"上,而是在名称空间源中的本地仓库中.

They are pulled.
And you see them, not on "remote", but in your local repo in the namespace origin.

如果您真的想将那些远程跟踪分支作为分支,请参阅我在" git pull from远程存储库"

If you really want to have those remote tracking branches as branches, see the onle-liner I use at "git pull all branches from remote repository"

$ remote=origin ; for brname in `git branch -r | grep $remote | grep -v master | grep -v HEAD | awk '{gsub(/[^\/]+\//,"",$1); print $1}'`; do git branch -t $brname $remote/$brname ; done 

一旦所有本地分支都在跟踪远程跟踪分支,如果要全部拉出,则仍然必须使用脚本分支 .

Once all local branches are tracking remote tracking branches, you would still have to use a script if you were to pull all branches.

这篇关于Git:从裸露的USB遥控器中拉出所有东西的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆