echo Impossible|sed 's/Im/To be /'

December 21, 2009

[tip] Use repo manage more then one git repositories.

如何利用 Google repo 管理多個 git repository?

配置多個 git repository. 如下

110碼:AAA2369 $> mkdir Luffy.git  Nami.git  Nico.git

110碼:AAA2369 $> cd Luffy.git ; git-init-db
110碼:AAA2369 $> echo hello Luffy > Luffy-README 
110碼:AAA2369 $> git add Luffy-README 
110碼:AAA2369 $> git commit -m "add readme" Luffy-README 
110碼:AAA2369 $> cd ..

110碼:AAA2369 $> cd Nami.git ; git-init-db
110碼:AAA2369 $> echo hello Nami > Nami-README 
110碼:AAA2369 $> git add Nami-README
110碼:AAA2369 $> git commit -m "add readme" Nami-README 
110碼:AAA2369 $> cd ..

110碼:AAA2369 $> cd Nico.git ; git-init-db 
110碼:AAA2369 $> echo hello Nico > Nico-README
110碼:AAA2369 $> git add Nico-README
110碼:AAA2369 $> git commit -m "add readme" Nico-README 
110碼:AAA2369 $> cd ..

110碼:AAA2369 $> mkdir manifests.git
110碼:AAA2369 $> cd manifests.git ; git-init-db
110碼:AAA2369 $> cat <<EOF> default.xml
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
  <remote  name="korg"
           fetch="file:///home/lloyd/temp/git-repo-top/" />
  <default revision="master"
           remote="korg" />
  <project path="Luffy" name="Luffy" />
  <project path="Nami" name="Nami" />
  <project path="Nico" name="Nico" />
</manifest>

EOF

110碼:AAA2369 $> git add default.xml
110碼:AAA2369 $> git commit -m "add default.xml" default.xml

開發者下載並安裝 repo. 利用 repo 同步下載多個 git repository.

110碼:AAA2369 $> curl http://android.git.kernel.org/repo >~/bin/repo
110碼:AAA2369 $> chmod a+x ~/bin/repo

110碼:AAA2369 $> mkdir ~/devel-git/
110碼:AAA2369 $> cd ~/devel-git/
110碼:AAA2369 $> repo init -u file:///home/lloyd/temp/git-repo-top/manifests.git
Your Name  [lloyd huang]:
.....
repo initialized in /home/lloyd/devel-git

110碼:AAA2369 $> repo sync
Initializing project Luffy ...
 * [new branch]      master     -> korg/master

Initializing project Nami ...
 * [new branch]      master     -> korg/master

Initializing project Nico ...
 * [new branch]      master     -> korg/master

110碼:AAA2369 $> ls -la
drwxr-xr-x 3 lloyd lloyd 4096 2009-12-21 22:39 Luffy
drwxr-xr-x 3 lloyd lloyd 4096 2009-12-21 22:39 Nami
drwxr-xr-x 3 lloyd lloyd 4096 2009-12-21 22:39 Nico
drwxr-xr-x 6 lloyd lloyd 4096 2009-12-21 22:39 .repo

Hope this can help you!