`
scm002
  • 浏览: 310082 次
社区版块
存档分类
最新评论

Repo/Git 使用手冊, android開發圖說如何使用指令

 
阅读更多

安裝repo

參考:http://source.android.com/source/downloading.html
1. To install Repo:
Make sure you have a bin/ directory in your home directory and that it is included in your path:

$ mkdir ~/bin
$ PATH=~/bin:$PATH

Download the Repo tool and ensure that it is executable:

$ curl http://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo

2.Initializing a Repo client
Create an empty directory to hold your working files.
只有在此目錄底下, 能使用指令repo

$ mkdir WORKING_DIRECTORY
$ cd WORKING_DIRECTORY

Run repo init to bring down the latest version of Repo with all its most recent bug fixes. You must specify a URL for the manifest, which specifies where the various repositories included in the Android source will be placed within your working directory.

$ repo init -u https://android.googl

Downloading the Android Source Tree
To pull down the Android source tree to your working directory from the repositories as specified in the default manifest, run

$ repo sync

或是 Try using following command, here -c make much lesser time
here -c is used as current branch defined in your manifest. so other data wont get fetched

$ repo sync -c -j5

repo 簡單說明:

其實repo就是用來管理git的工具
所以一定要學會使用 repo forall -c xxxxxxx 這個常用語法結構

#查看所有git狀態
repo forall -c “git status"

#所有git都切換至branch,名稱為"branch_abc"
repo forall -c “git checkout branch_abc"

#查看某個commit的資訊
repo forall -c git log –oneline | grep “commit name"

#上傳修改的部分(類似git push)
repo [–trace] upload

#初始設定repo
repo init -u ssh://@10.xx.xx.xx/opt/git/antares/android/manifest.git -b antares-xxxx –mirror

根據Android Developing提供易上手說明:

(原文版)

基本使用流程:
1. repo sync 先下載程式碼
2. repo start CHECJIN_BRANCH –all 對所有git project建立一個叫 CHECJIN_BRANCH(或其他自取名稱) 的branch
3. 改source code 東改西改, 假設你改了2個git project程式碼
4. 在這2個擬修改的git, 作git commit
5. repo upload (如果出現 # Uncomment the branches to upload: 就把底下的#移除作uncomment吧!)

然後接著 git與repo搭配使用:

—————————-

git 簡單說明:

#Set commiter/creator name/email
git config –global user.name “XXXX"
git config –global user.email “xxxx@xxxxx.com"

#how to use git://xxx/ ?
apt-get install git-daemon-run
vi /etc/sv/git-daemon-run/run
exec git-daemon –verbose –export-all –base-path=$git_path
sv restart git-daemon

#Client
git clone git://$server_ip/project.git

#create a git respository
#create some files
git init

#To visualize branches:
git branch -a

#To create a new branch:
git branch testbranch

# create branch from a commitid
git branch recover_branch commitid

#To change to created branch:
git checkout -b testbranch

#pull data from branch
git pull origin testbranch

#commit created branch name to remote git server
git push origin testbranch

#delete remote branch name
git push origin :testbranch

#To delete a local branch (you need be in other branch to do that):
git branch -D testbranch

#retrieve local deleted file from git server
git checkout file-name

#Track new files:
git add xxxxx.c

#To make a commit:
git commit -a

#To remove the last commit:
git reset –hard HEAD^

# 修改上一次的 commit 訊息
git commit –amend

# 修改將檔案1、檔案2加入上一次的 commit
git commit –amend 檔案1 檔案2…

#Create patches between two branches:
git format-patch master..testbranch

#Create all patch files for changes
git format-patch start-commit-id

#ex: xxx5.1
git format-patch e3d6a36d645fcc210adaf73652295d36cf0c87a1

#reate patches into single file
git format-patch master –stdout > fix_empty_poster.patch

#Check patch
git apply –check fix_empty_poster.patch

#Sign off an applied patch
git am –signoff fix_empty_poster.patch

#abort previous changes ( “previous rebase directory .git/rebase-apply still exists but mbox given" )
git am –abort

#Apply patch & update creator to myself
git apply –index 
git commit

#create a tag
git tag -a -m “tagging version 1.0″ v1.0

#push tag
git push –tags

#You can also push a single tag:
git push origin tag name-of-tag

# rename new tag and push it
$> git tag new_tag old_tag
$> git push –tags

#Then delete the tag ‘12345’ from remote and local
git tag -d 12345
git push origin :refs/tags/12345

#//clone from remote git server
git clone ssh://example.com/var/cache/git/project_name.git
cd project_name
touch index.html
git add index.html
git commit -m ‘init’
git push origin master # local 預設 clone 是 master, push 到 origin(remote server)

# Create the remote branch
git push origin origin:refs/heads/new_feature_name

# reverse list
git diff $(git rev-list -n1 –before="1 day ago" master)

# 手動 merge master commit to RELEASE branch
git checkout master
git pull
git format-patch start-commit-id
git checkout RELEASE (first time: git checkout -b RELEASE )
git pull origin RELEASE
git apply –check 0008-xxx.patch
git am –signoff 0008-xxx.patch
git push origin RELEASE

#Create patches between two branches:
git format-patch master..testbranch

#Create all patch files for changes
git format-patch start-commit-id

#ex:
git format-patch e3d6a36d645fcc210adaf73xxxxxx36cf0c87a1

#Create patches into single file
git format-patch master –stdout > fix_empty_poster.patch

#Check patch
git apply –check fix_empty_poster.patch

#Sign off an applied patch
git am –signoff fix_empty_poster.patch

#abort previous changes ( “previous rebase directory .git/rebase-apply still exists but mbox given" )
git am –abort

Git 初學筆記 – 指令操作教學
http://blog.longwin.com.tw/2009/05/git-learn-initial-command-2009/

git: 如何用git-am来合并git format-patch生成的一系列的patch.
http://www.thinksrc.com/2010/04/22/git-am.html

一篇寫得很易懂得git repository:
http://tkg.im.ncue.edu.tw/?p=755

gitweb設定 (on Ubuntu 10.04)
http://blog.xuite.net/yctseng/notes/35220134

超易懂投影片
http://www.slideshare.net/littlebtc/git-5528339

 

http://eeepage.info/git-repository-notes/

分享到:
评论

相关推荐

    repo,解决fatal: Cannot get https://gerrit.googlesource.com/git-repo

    18年7月更新,清华镜像,完美解决 Yocto,Android fatal: Cannot get https://gerrit.googlesource.com/git-repo/clone.bundle 错误,绕开GFW

    android_repo_from_storage-googleapis-com.zip

    android系统源码下载工具repo,下载源:https://storage.googleapis.com/git-repo-downloads/repo

    git-repo.git.rar

    将git-repo.git目录下的repo拷贝到 /usr/bin: cd git-repo.git sudo cp repo /usr/bin/repo_gitadmin 修改 repo vi /usr/bin/repo_gitadmin 修改 REPO_URL = 'https://gerrit.googlesource.com/git-repo' REPO_REV...

    bspmini2440-example--upload.rar

    git clone http://git.sylixos.com/repo/sylixos-base.git git clone http://git.sylixos.com/repo/bspmini2440.git git clone http://git.sylixos.com/repo/examples.git git clone ...

    android repo 文件

    kernel.org无法访问导致android的源码无法下载,这是另外一个git服务器的android源码的repo文件。 操作如下 $ curl "http://php.webtutor.pl/en/wp-content/uploads/2011/09/repo" > ./repo //获取repo $ chmod a+...

    Git_和repo扫盲

    Git_和repo扫盲

    完整repo-project

    15年6月更新,完整的repo-project,完美解决fatal: Cannot get https://gerrit.googlesource.com/git-repo/clone.bundle 错误,绕开GFW,详细请参考我的博客《完美解决repo init 错误 fatal: Cannot get ...

    repo.git.zip

    repo git工具 使用: repo init --repo-url ssh://git@localhost/repo.git -u xxxx.git -b xxxx -m xxxx.xml

    repo to git

    reop库转换成git库的代码,将文件解压到repo目录,通过repo togit命令新建/更新git

    git-repo 2015/04/28版本

    git-repo 2015/04/28版本

    googleapis的repo工具

    原地址:http://commondatastorage.googleapis.com/git-repo-downloads/repo,不方便的可以在这里下载

    repo1.22-20160724

    https://aosp.tuna.tsinghua.edu.cn/android/git-repo才可以正常使用, 否则会出现如下错误, Get git://aosp.tuna.tsinghua.edu.cn/android/git-repo fatal: unable to connect to aosp.tuna.tsinghua.edu.cn: aosp....

    完整的repo-project

    15年6月更新,完整的repo-project,完美解决fatal: Cannot get https://gerrit.googlesource.com/git-repo/clone.bundle 错误,绕开GFW。

    android repo

    这个是我之前下载好的4.0.3源码.repo里面的repo文件,应该是没问题的。这个需要将文件中的REPO_URL='https://code.google.com/p/git-repo/'改为REPO_URL='http://code.google.com/p/git-repo/'

    多git版本管理-repo

    • 从高通或google下载代码是通过repo下载的,是由repo管理的266个git组成的 • l现在使用的git库是将由repo管理266个小git合并成一个git库导入 • 目前导入的repo是将项目定制化的内容取出,拆成由repo管理45个小...

    Git-Repo:用于从工作区管理git服务的CLI实用程序-Python开发

    git services CLI实用程序要获取源代码:https://github.com/guyzmo/git-repo https://gitlab.com / guyzmo / git-repo https://bitbucket.org/guyzmo/git-repo问题:https://github.com/guyzmo/git-repo/issues与...

    Repo git的入门使用.doc

    Repo git的入门使用、常用的命令、提交代码的过程与原理,冲突的产生原因、原理及如何避免,巧妙的使用分支

    Python的Git开发包GitPython.zip

    GitPython 是一个 Python 库用来和 Git 资料库进行交互,提供各种级别的操作,例如高级的 git-...repo = Repo.init("/var/git/git-python.git", bare=True) assert repo.bare == True 标签:GitPython

    repo 下载android源代码必备

    由于官网https://dl-ssl.google.com/dl/googlesource/git-repo/repo被封 而网上很多人的http://php.webtutor.pl/en/wpcontent/uploads/2011/09/repo 是个过时的东西,执行repo sync会出错 本人提供的虽然不是最新...

    git(mac/win) 两种版本.zip

    压缩包中有两种版本的git,mac和windows版本mac下的为git-2.15.0windows下的git- 2.15.1.2-64bit

Global site tag (gtag.js) - Google Analytics