Pageviews

Tuesday, November 19, 2013

How to effectively use repo and git for AOSP?

"Repo is a wrapper command line tool for Git."

Why repo? Because a AOSP source tree is huge and consists many projects, for example, framework/av is a project, hardware/qcom is another project.
Instead of git commit individual and then push to the remote server, Google team has implemented this Repo as a central commander which manages all git commit for all projects.


To be able to effectively working on AOSP. Once your downloaded your source tree using "repo sync"

1, go to home directory, in my case its at android/kitkat/

2, repo start [branch] [path to project]

I was confused about project paths, however there is a easy way to figure it out. As you "cd" through your source tree, if a sub folder contains a ".git" hidden file, then this sub folder is a project. The absolute path to this project is [path to project].

This makes sense because repo manages all git repositories and each git repository is a project.

[branch] name can be totally random.

To confirm what this command has done, find the .git directory, then do "git status", you should be able to find the [branch] name initialized by repo command.

3, After you modify the source code in a project. you should commit to local .git repository.
Using git commit -m 'COMMENTS'
You may push the modified source code to your public git profile.

for example, my git username is "fangboy" and I want to push project "media.git"

               git remote add origin https://github.com/fangboy/media.git 
               # Creates a remote named "origin" pointing at your GitHub repository

               git push origin [branch]
               # Sends your commits in the "master" branch to GitHub


As always, you are welcome.