2014-03-05 154 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插件做到這一點?任何想法 –

相關問題