2011年6月15日 星期三

使用repo sync 作為同步方式的git code database

       我們使用同一台電腦的兩個不同 folder來作為code_server 及code_client,以下將分別說明在code_server 如何建置,在code_client 如果同步。

  

     Code_Server 端:
      1。建立一個.repo 的目錄
      2。在.repo 的目錄下,建立一個manifests的目錄
      3。在manifest目錄下產生一個default.xml 的檔,並建立一個softlink (manifest.xml)到.repo的根目錄下。
      
      4。在code_server 下,建立一個mycode1 的folder ,裡面先放入一個code1.c 的檔,並且git init 成為一個git 的codebase。


    5。在.repo下,建立一個projects 的目錄,其下建立一個softlink 名為mycode1.git ,連到mycode1下的.git folder


    
   6。修改default.xml 如下:

    

   7。到.repo/manifests 目錄下,建立git database,並且在在.repo 下建立manifest.git 的 softlink到,manifest 下的.git   


     Code_Client 端:

     1. 使用以下repo 指令,先抓下manifest.xml
     2. 接著下repo sync的指,開始同步 code
     3. 可以到code 的目錄看文件內容是否一致同步下來了 (done)