安裝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/
相关推荐
18年7月更新,清华镜像,完美解决 Yocto,Android fatal: Cannot get https://gerrit.googlesource.com/git-repo/clone.bundle 错误,绕开GFW
本文将指导读者从头开始搭建一个完整的代码评审服务器,使用 Git、Repo 和 Gerrit 等工具。本篇文章将详细介绍每个步骤的配置过程,旨在帮助读者快速搭建一个功能完善的代码服务器。 代码服务器搭建步骤 名词解释 ...
15年6月更新,完整的repo-project,完美解决fatal: Cannot get https://gerrit.googlesource.com/git-repo/clone.bundle 错误,绕开GFW,详细请参考我的博客《完美解决repo init 错误 fatal: Cannot get ...
repoinit -u git://android.git.kernel.org/platform/manifest.git -b cupcake ``` ##### 同步版本库 使用`reposync`命令,可以将所有子项目的代码同步至本地仓库。对于大型项目,这一过程可能耗时较长,建议在非...
将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...
在Android开发过程中,掌握如何获取和管理源代码是至关重要的,`repo`工具就是为此而生的。`repo`是一个Python脚本,用于简化从Git仓库中获取、更新和管理工作流,它是由Google为Android项目专门设计的。在这个场景...
Repo Git 是Google为管理大型项目,特别是Android版本库而开发的一款工具。它建立在Git之上,提供了一种更高效的方式来组织和操作多个Git仓库。本文将深入探讨Repo Git的入门使用,常用命令,以及如何处理代码冲突。...
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 ...
这个命令允许我们把repo管理的多个Git仓库转化为单一的Git仓库,方便开发者使用Git进行日常开发工作。 在提供的压缩包文件中,我们可以看到以下几个Python文件: 1. **tg_objects.py**: 这可能包含了与Git对象(如...
Git Repo是Google开发的一个工具,它不是Git的一部分,但与Git紧密相关,主要用于管理多个Git仓库。这个"git-repo 2015/04/28版本"可能包含了该日期更新的Repo源码或者相关文档。在本文中,我们将深入探讨Git和Repo...
15年6月更新,完整的repo-project,完美解决fatal: Cannot get https://gerrit.googlesource.com/git-repo/clone.bundle 错误,绕开GFW。
在Android开发中,由于项目包含许多不同的子项目,每个都有自己的Git仓库,使用repo可以方便地管理和同步这些仓库。 使用repo的步骤如下: 1. **安装repo**: 首先,你需要将“repo.git.zip”解压,然后将repo脚本...
了解和熟练掌握Git和Repo的使用对于参与Android开发至关重要。Git提供了强大的版本控制功能,而Repo则是简化Android源码管理的实用工具。在实际开发中,你可能会遇到分支切换、合并代码、提交变更等操作,这些都是...
Repo是Google为Android项目提供的一个分布式版本控制系统,它基于Git之上构建,主要用于管理大型项目的多仓库结构。通过Repo工具,开发者可以方便地管理多个Git仓库,并实现统一的构建流程。 #### 知识点二:下载...
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....
7. 版本控制策略:良好的Git实践包括定期拉取最新代码(`git pull`)、使用分支隔离开发任务、避免直接在主分支上提交代码,以及利用`git rebase`或`git merge --no-ff`进行冲突较少的合并。 总之,Git是软件开发不...
原地址:http://commondatastorage.googleapis.com/git-repo-downloads/repo,不方便的可以在这里下载
• 从高通或google下载代码是通过repo下载的,是由repo管理的266个git组成的 • l现在使用的git库是将由repo管理266个小git合并成一个git库导入 • 目前导入的repo是将项目定制化的内容取出,拆成由repo管理45个小...
这个是我之前下载好的4.0.3源码.repo里面的repo文件,应该是没问题的。这个需要将文件中的REPO_URL='https://code.google.com/p/git-repo/'改为REPO_URL='http://code.google.com/p/git-repo/'