repo常用相關(guān)命令
1旦签、repo start <topic_name>
???? 開啟一個新的主題,其實就是每個Project都新建一個分支儡司。
???? repo start newbranchname .
????? 創(chuàng)建新的branch分支限匣。 "." 代表當(dāng)前工作的branch 分支。
2徙融、repo init -u <url> [OPTIONS]
?????? repo init -u git://android.git.kernel.org/platform/manifest.git
repo init -u URL 用以在當(dāng)前目錄安裝 repository ,會在當(dāng)前目錄創(chuàng)建一個目錄 ".repo"? -u 參數(shù)指定一個URL瑰谜, 從這個URL 中取得repository 的 manifest 文件欺冀。
在當(dāng)前目錄下初始化repo,會在當(dāng)前目錄生生成一個.repo目錄萨脑,像Git? Project下的.git一樣隐轩,-u指定url,可以加參數(shù)-m指定manifest文件渤早,默認(rèn)是default.xml职车,.repo/manifests保存manifest文件。.repo/projects下有所有的project的數(shù)據(jù)信息鹊杖,repo是一系列g(shù)it project的集合悴灵,每個git project下的.git目錄中的refs等目錄都是鏈接到.repo/manifests下的。
??????? repo init -u git://android.git.kernel.org/platform/manifest.git -m dalvik-plus.xml
可以用 -m 參數(shù)來選擇獲取 repository 中的某一個特定的 manifest 文件骂蓖,如果不具體指定积瞒,那么表示為默認(rèn)的 namifest 文件 (default.xml)
???????? repo init -u git://android.git.kernel.org/platform/manifest.git -b release-1.0
?? 可以用 -b 參數(shù)來指定某個manifest 分支。
3登下、repo manifest
可以根據(jù)當(dāng)前各Project的版本信息生成一個manifest文件
4茫孔、repo sync [PROJECT1...PROJECTN]
下載最新本地工作文件,更新成功被芳,這本地文件和repository 中的代碼是一樣的缰贝。 可以指定需要更新的project , 如果不指定任何參數(shù)畔濒,會同步整個所有的項目剩晴。
如果是第一次運行repo sync , 則這個命令相當(dāng)于 git clone 篓冲,會把 repository 中的所有內(nèi)容都拷貝到本地李破。 如果不是第一次運行repo sync , 則相當(dāng)于 git remote update ;? git rebase origin/branch .? repo sync 會更新 .repo 下面的文件壹将。 如果在merge 的過程中出現(xiàn)沖突嗤攻, 這需要手動運行? git? rebase
--continue
舉例: repo sync -j8 prebuilts/maven_repo/android
5、repo status
顯示 project 中每個倉庫的狀態(tài)诽俯,并打印倉庫名稱妇菱。
查看本地所有Project的修改承粤,在每個修改的文件前有兩個字符,第一個字符表示暫存區(qū)的狀態(tài)闯团。
- 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
每二個字符表示工作區(qū)的狀態(tài)
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>
刪除已經(jīng)merge的分支
7、repo abandon <topic>
刪除分支房交,無論是否merged
8彻舰、repo branch或repo branches
查看所有分支
9、repo diff
查看修改
repo diff platform/build platform/bionic? ---只查看其中兩個項目
10候味、repo upload
上傳本地提交至服務(wù)器
11刃唤、repo forall [PROJECT_LIST]-c COMMAND
對指定的Project列表或所有Project執(zhí)行命令COMMAND,加上-p參數(shù)可打印出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倉庫笼裳,并在每個倉庫執(zhí)行-c所指定的命令(被執(zhí)行的命令不限于git命令,而是任何被系統(tǒng)支持的命令粱玲,比如:ls 躬柬、 pwd 、cp 等 密幔。
14楔脯、repo forall -c git checkout -b? 本地分支名稱(自定義)? 服務(wù)器分支名稱
下載新的分支
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執(zhí)行的時候加上-p參數(shù)就可以在遍歷到每個倉庫的時候先打印出當(dāng)前的pwd木柬,然后再繼續(xù)執(zhí)行-c所指定的命令。
repo forall -c ‘echo $REPO_PROJECT’
添加環(huán)境變量淹办。
20眉枕、repo foreach [ project-lists] -c command
? ? ?? 對每一個 project 運行 command 命令
21、repo download? target revision
? ? ? ? 下載特定的修改版本到本地怜森, 例如:? repo download pltform/frameworks/base 1241 下載修改版本為 1241 的代碼
22速挑、repo remote
設(shè)置遠程倉庫
repo remote add <remotename>? <url> [<project>…]
repo remote rm <remotename>? [<project>…]
repo remote add org ssh://172.16.1.31/git_repo
這個指令是根據(jù)xml文件添加的遠程分支,方便于向服務(wù)器提交代碼副硅,執(zhí)行之后的build目錄下看到新的遠程分支org
repo? remote? rm? org
刪除遠程倉庫
23姥宝、repo push
向服務(wù)器提交代碼
repo push org
repo push <remotename> [--all |<project>…]
repo會自己查詢需要向服務(wù)器提交的項目并提示用戶。
24恐疲、repo manifest
顯示manifest文件內(nèi)容
repo manifest -o android.xml