2014-03-05 155 views
1

我公司的一些人使用Repo来管理多个存储库。我需要阅读(不改变/提交)这些内容。使用Git同步“回购”存储库中的一个项目

我希望避免安装回购,只使用Git。这里提供了让我关心的存储库中的说明:

repo init -u git://git-master/x/manifest.git -b dev/foo-bar -m bar.xml 
repo sync 

如何使用香草Git用相同的信息同步?

回答

1

git-repo使用名为manifest.xml的文件列出项目的所有git存储库。

要仅使用git访问存储库,只需获取manifest.xml,读取存储库URL并克隆它。


第一:获取清单

$ git clone -b dev/foo-bar git://git-master/x/manifest.git 
$ vi manifest/bar.xml 

二:读库URL

你应该有这样的事情(检查manifest format):

<?xml version="1.0" encoding="UTF-8"?> 
<manifest> 

    <remote name="origin" fetch="git://git-master/x" /> 

    <default revision="master" remote="origin" /> 

    <project name="my/first/project" /> 
    <project name="my/second/project" /> 

</manifest> 

搜索回购想要克隆的基准(例如my/second/project),请从manifest.remote.fetch属性构建克隆URL。在这里,我们有:

clone URL = git://git-master/x/my/second/project 

注:manifest.remote.fetch可以是绝对或相对URL。如果它是亲戚,你必须在之前添加清单URL。


三:克隆库

git clone git://git-master/x/my/second/project 

注:您可以检查manifest.default.revisionmanifest.project.revision,以确保您有获取良好的分支。


尽管如此,由于repo只是一个脚本,你可以在你的主目录下轻松安装,就像这样:

$ mkdir ~/bin 
$ PATH=~/bin:$PATH 
$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo 
$ chmod a+x ~/bin/repo 
+0

如何使用例如:It Eclipse插件做到这一点?任何想法 –

相关问题