repo相關命令


 

1、repo start <topic_name>

  開啟一個新的主題,其實就是每個Project都新建一個分支。

repo start newbranchname .

 創建新的branch分支。 "." 代表當前工作的branch 分支。

 

2、repo init -u <url> [OPTIONS] 

repo init -u git://android.git.kernel.org/platform/manifest.git

  repo init -u URL 用以在當前目錄安裝 repository ,會在當前目錄創建一個目錄 ".repo"  -u 參數指定一個URL, 從這個URL 中取得repository 的 manifest 文件。

  在當前目錄下初始化repo,會在當前目錄生生成一個.repo目錄,像Git Project下的.git一樣,-u指定url,可以加參數-m指定manifest文件,默認是default.xml,.repo/manifests保        存manifest文件。.repo/projects下有所有的project的數據信息,repo是一系列git project的集合,每個git project下的.git目錄中的refs等目錄都是鏈接到.repo/manifests下的。 

repo init -u git://android.git.kernel.org/platform/manifest.git -m dalvik-plus.xml

  可以用 -m 參數來選擇獲取 repository 中的某一個特定的 manifest 文件,如果不具體指定,那么表示為默認的 namifest 文件 (default.xml) 

repo init -u git://android.git.kernel.org/platform/manifest.git -b release-1.0

  可以用 -b 參數來指定某個manifest 分支。

 

3、repo manifest

  可以根據當前各Project的版本信息生成一個manifest文件

 

4、repo sync [PROJECT1...PROJECTN]

  下載最新本地工作文件,更新成功,這本地文件和repository 中的代碼是一樣的。 可以指定需要更新的project , 如果不指定任何參數,會同步整個所有的項目。

  如果是第一次運行 repo sync , 則這個命令相當於 git clone ,會把 repository 中的所有內容都拷貝到本地。 如果不是第一次運行 repo sync , 則相當於 git remote update ;  git   rebase origin/branch .  repo sync 會更新 .repo 下面的文件。 如果在merge 的過程中出現沖突, 這需要手動運行  git  rebase --continue

 

5、repo status

  顯示 project 中每個倉庫的狀態,並打印倉庫名稱。

  查看本地所有Project的修改,在每個修改的文件前有兩個字符,第一個字符表示暫存區的狀態。

- no change same in HEAD and index
A added not in HEAD, in index
M modified in HEAD, modified in index
D deleted in HEAD, not in index
R renamed not in HEAD, path changed in index
C copied not in HEAD, copied from another in index
T mode changed same content in HEAD and index, mode changed
U unmerged conflict between HEAD and index; resolution required

  每二個字符表示工作區的狀態 

letter meaning description
- new/unknown not in index, in work tree
m modified in index, in work tree, modified
d deleted in index, not in work tree

 6、repo prune <topic> 

  刪除已經merge的分支

 

7、repo abandon <topic>

  刪除分支,無論是否merged

 

8、repo branch或repo branches

  查看所有分支

 

9、repo diff

  查看修改

repo diff platform/build platform/bionic  ---只查看其中兩個項目

 

10、repo upload

  上傳本地提交至服務器

 

11、repo forall [PROJECT_LIST]-c COMMAND

  對指定的Project列表或所有Project執行命令COMMAND,加上-p參數可打印出Project的路徑。

 

12、repo forall -c 'git reset --hard HEAD;git clean -df;git rebase --abort'

repo forall –c ‘git remote add korg ssh://xiong@172.16.31/$REPO_PROJECT.git’

 

  這個命令可以撤銷整個工程的本地修改。

 

13、repo forall -c

  遍歷所有的git倉庫,並在每個倉庫執行-c所指定的命令(被執行的命令不限於git命令,而是任何被系統支持的命令,比如:ls 、 pwd 、cp 等 。

 

14、repo forall -c git checkout -b  本地分支名稱(自定義)  服務器分支名稱

  下載新的分支

 

15、repo forall -c git checkout your_branch

  切換到另外一個分支

 

16、repo forall -c git branch -D  分支名稱

  刪除分支

 

17、repo forall -c git git reset --hard HEAD

  丟棄修改

 

18、repo  forall -r kernel/linux-3.10.y bootable/bootloader/uboot-2015.04  -c git reset --hard HEAD

  對指定的倉進行操作,-r后跟倉名

 

19、repo forall -p -c git branch   

  repo執行的時候加上-p參數就可以在遍歷到每個倉庫的時候先打印出當前的pwd,然后再繼續執行-c所指定的命令。 

repo forall –c ‘echo $REPO_PROJECT’

  添加環境變量。

20、repo foreach [ project-lists] -c command

       對每一個 project 運行 command 命令

 

21、repo download  target revision

        下載特定的修改版本到本地, 例如:  repo download pltform/frameworks/base 1241 下載修改版本為 1241 的代碼

 

22、repo remote

  設置遠程倉庫 

repo remote add <remotename>  <url> [<project>…] 

repo remote rm <remotename>  [<project>…]
repo remote add org ssh://172.16.1.31/git_repo

  這個指令是根據xml文件添加的遠程分支,方便於向服務器提交代碼,執行之后的build目錄下看到新的遠程分支org  

repo  remote  rm  org

  刪除遠程倉庫

23、repo push 

  向服務器提交代碼

repo push org
repo push <remotename> [--all |<project>…]

  repo會自己查詢需要向服務器提交的項目並提示用戶。

 

24、repo manifest

  顯示manifest文件內容 

repo manifest –o android.xml

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM