Android-fire git and repo literacy-how to get the Android source code (RPM)

Source: Internet
Author: User
Tags python script version control system git clone

Git is an open source distributed version control software developed by Linux Torvalds to help manage Linux kernel development, unlike a centralized version control system such as Subversion and CVS. In a centralized version control system there is only one warehouse (repository), many working directories (working copy), and in a distributed version control system like Git (other major distributed version control systems include BitKeeper, Mercurial, GNU Arch, Bazaar, Darcs, SVK, monotone, etc.), each working directory contains a complete warehouse that can support offline work, and local submissions can be submitted to the server later. Distributed systems are theoretically more robust than centralized single server systems, and a single server system cannot run without problems with the server, and distributed systems are not usually affected by one or two nodes.

Because Android is made up of a number of GIT projects, such as kernel, Dalvik, Bionic, prebuilt, build, the Android project wrote a python script called Repo to manage the warehouses of these projects uniformly. Makes git easier to use.




1. Git installation
Install Git on Ubuntu 8.04 as long as you set the correct source for the update, and then use the apt-get on it, there is any dependency problem, let it solve it itself. Where curl is a file transfer tool that works under the command line using URL syntax, which is used when installing repo later.
Java code
sudo apt-get install Git-core curl


sudo apt-get install Git-core curl

2. Installation Repo
First make sure to create a/bin directory (if not) under the current user's home directory, and then add it (~/bin) to the PATH environment variable
Next, download the repo script via curl and save it to the ~/bin/repo file.
Java code
Curl Http://android.git.kernel.org/repo >~/bin/repo


Curl Http://android.git.kernel.org/repo >~/bin/repo

Don't forget to give repo permission to execute.
Java code
chmod a+x ~/bin/repo


chmod a+x ~/bin/repo

3, initialize the version of the library
If you want to take down all the SourceCode on the latest version of Android's current line, we need repo help.
First create a directory, such as ~/android, go in and use the Repo init command.
Java code
Repo Init-u Git://android.git.kernel.org/platform/manifest.git


Repo Init-u git://android.git.kernel.org/platform/manifest.git This process will last a long time (at least a good sleep), how much time will depend on the network conditions
Finally, you'll see a hint like repo initialized in/android that the local version library has been initialized and contains the current latest sourcecode.

If you want to take a branch rather than the mainline code, we need to use the-B parameter to make the branch name, such as:
Java code
Repo Init-u git://android.git.kernel.org/platform/manifest.git-b Cupcake


Repo Init-u git://android.git.kernel.org/platform/manifest.git-b Cupcake

In another case, we just need some project code, like Kernel/common, that doesn't need to be repo, just use Git.
Java code
git clone git://android.git.kernel.org/kernel/common.git


git clone git://android.git.kernel.org/kernel/common.git This also takes a lot of time because it will replicate the entire Linux kernel code.

If you need a branch code, use git checkout. For example, we have just taken the Kernel/common.get code, then go to the Common directory, and then use the following command:
Java code
git checkout origin/android-goldfish-2.6.27-b Goldfish


git checkout origin/android-goldfish-2.6.27-b Goldfish
So we built a local android-goldfish-2.6.27 branch called Goldfish, and the code was synchronized with android-goldgish-2.6.27. We can list all the local branches through Git branch.

4. Sync Version Library
Using the EPO Sync command, we sync the entire Android code tree locally, and again, we can use a similar
Java code
Repo Sync Project1 project2 ...


Repo sync Project1 project2 ...
Such a command to synchronize a few items

If you are synchronizing a single item in Android, just perform a simple
git pull
in the project directory.

5, download code via Gitweb
In addition, if you just need the code for a project on the main line, you can also download it by Gitweb, shortlog use keywords to search for a specific version, or find a few newer tags to download or it's easy.  &NBSP
  
       Thanks to the original author William, saved me a lot of time, you try to share ~ ~
      git was originally designed for Linux kernel development, so support for other platforms is not good, especially for Windows platforms, which have to be Cygwin. Now, thanks to the Msysgit project, we've been able to use Git without cygwin. In addition, Git extensions is a very useful Windows shell extension that is tightly integrated with the resource manager and even provides Visual Studio Plug-ins. Its official website has a good description of the document, interested friends can take a look at the

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.