Git and repo literacy-how to obtain Android source code

Source: Internet
Author: User
Tags mercurial

Git is Linux Torvalds to help manage Linux
An open source distributed version control software developed by the kernel is different from a centralized version control system such as subversion and CVS. There is only one warehouse in the centralized version control system.
Library (repository), many working directories, while in distributed version control systems such as git (other major distributed version control systems also have bitkeeper
, Mercurial
, GNU Arch
Bazaar
, Darcs
, SVK
Monotone
), Each working directory contains a complete warehouse,They support offline work, and local submission can be submitted to the server later. In theory, distributed systems are more robust than centralized single-server systems. Once a single-server system encounters a server problem, the entire system cannot run. distributed systems are generally not affected by one or two nodes.
.

Because Android is composed of multiple git projects such as kernel, Dalvik, bionic, prebuilt, and build, the android project has compiled a Python script named repo to manage the repositories of these projects in a unified manner, this makes git easier to use.

In order to get the latest sourcecode of Android, William Learned some basic operations of git and repo, sorted out how-to for how to get the android code, and pasted it today.

1. Install git

To install git on Ubuntu 8.04, you only need to set the correct update source and use apt-Get. If there is any dependency problem, let it solve it by yourself. Curl is a File Transfer tool that uses the URL syntax to work in the command line. It will be used when repo is installed later.
Sudo apt-Get install Git-core curl

2. Install Repo

First, make sure to create a/bin directory under the current user's home directory (if not), and then put it (~ /Bin) added to the PATH environment variable
Download the repo script through curl and save it ~ /Bin/repo File
Curl http://android.git.kernel.org/repo> ~ /Bin/Repo

Do not forget to grant repo executable permissions
Chmod A + x ~ /Bin/Repo

3. initialize the version Library

If you want to take down all the sourcecodes in the latest version of the current Android main line, we need repo help.
First create a directory, such ~ /Android. Use the repo init command after entering the file.
Repo init-u git: // android.git.kernel.org/platform/manifest.git

This process will last for a long time (at least you can have a good sleep). The specific time depends on the network conditions.
Finally, you will see a prompt such as repo initialized in/Android, indicating that the local version library has been initialized and contains the latest sourcecode.

ThenRepo sync
Start to download the latest version.

If you want to use a branch instead of the Code on the main line, you need to use the-B parameter to specify the branch name, for example:
Repo init-u git: // android.git.kernel.org/platform/manifest.git-B cupcake

In another case, we only need the code of a project, such as kernel/common, without Repo. Just use git.
Git clone git: // android.git.kernel.org/kernel/common.git

This also takes a lot of time, because it will copy the entire Linux kernel code.

If you need a branch code, use git checkout. For example, if we have just obtained the kernel/common. Get code, we should first enter the common directory and then use the following command:
Git checkout origin/Android-goldfish-2.6.27-B goldfish

So we built a local Android-goldfish-2.6.27 branch named goldfish, and the code was synchronized with the android-goldgish-2.6.27. You can use git branch to list all local branches.

4. Synchronize the version Library

UseEPO sync
Command to synchronize the entire android code tree to the local device. Similarly, we can use
Repo sync project1 project2...

This command is used to synchronize several projects.

To synchronize a single project in Android, you only need to execute a simple
Git pull

You can.

5. Download Code through gitweb

In addition, if you only need the code of a project on the main line, you can also use gitweb
Download: Search for a specific version using keywords in commit log, or find several newer tags to download.

Git was initially designed for Linux kernel development, so it is not good to support other platforms, especially Windows platforms, which must have cygwin. Now, thanks to msysgit
Project, we can use git without cygwin. In addition, git extensions
Is a very useful Windows Shell extension, which can be closely integrated with the resource manager, and even provides Visual Studio plug-ins. Its official website has a good description document
If you are interested, you can take a look.

For git reference documents, I recommend git magic
Here is a Chinese version of git magic.
. Git is Linux Torvalds to help manage Linux
An open source distributed version control software developed by the kernel is different from a centralized version control system such as subversion and CVS. There is only one warehouse in the centralized version control system.
Library (repository), many working directories, while in distributed version control systems such as git (other major distributed version control systems also have bitkeeper
, Mercurial
, GNU Arch
Bazaar
, Darcs
, SVK
Monotone
), Each working directory contains a complete warehouse,They support offline work, and local submission can be submitted to the server later. In theory, distributed systems are more robust than centralized single-server systems. Once a single-server system encounters a server problem, the entire system cannot run. distributed systems are generally not affected by one or two nodes.
.

Because Android is composed of multiple git projects such as kernel, Dalvik, bionic, prebuilt, and build, the android project has compiled a Python script named repo to manage the repositories of these projects in a unified manner, this makes git easier to use.

In order to get the latest sourcecode of Android, William Learned some basic operations of git and repo, sorted out how-to for how to get the android code, and pasted it today.

1. Install git

To install git on Ubuntu 8.04, you only need to set the correct update source and use apt-Get. If there is any dependency problem, let it solve it by yourself. Curl is a File Transfer tool that uses the URL syntax to work in the command line. It will be used when repo is installed later.
Sudo apt-Get install Git-core curl

2. Install Repo

First, make sure to create a/bin directory under the current user's home directory (if not), and then put it (~ /Bin) added to the PATH environment variable
Download the repo script through curl and save it ~ /Bin/repo File
Curl http://android.git.kernel.org/repo> ~ /Bin/Repo

Do not forget to grant repo executable permissions
Chmod A + x ~ /Bin/Repo

3. initialize the version Library

If you want to take down all the sourcecodes in the latest version of the current Android main line, we need repo help.
First create a directory, such ~ /Android. Use the repo init command after entering the file.
Repo init-u git: // android.git.kernel.org/platform/manifest.git

This process will last for a long time (at least you can have a good sleep). The specific time depends on the network conditions.
Finally, you will see a prompt such as repo initialized in/Android, indicating that the local version library has been initialized and contains the latest sourcecode.

If you want to use a branch instead of the Code on the main line, you need to use the-B parameter to specify the branch name, for example:
Repo init-u git: // android.git.kernel.org/platform/manifest.git-B cupcake

In another case, we only need the code of a project, such as kernel/common, without Repo. Just use git.
Git clone git: // android.git.kernel.org/kernel/common.git

This also takes a lot of time, because it will copy the entire Linux kernel code.

If you need a branch code, use git checkout. For example, if we have just obtained the kernel/common. Get code, we should first enter the common directory and then use the following command:
Git checkout origin/Android-goldfish-2.6.27-B goldfish

So we built a local Android-goldfish-2.6.27 branch named goldfish, and the code was synchronized with the android-goldgish-2.6.27. You can use git branch to list all local branches.

4. Synchronize the version Library

UseEPO sync
Command to synchronize the entire android code tree to the local device. Similarly, we can use
Repo sync project1 project2...

This command is used to synchronize several projects.

To synchronize a single project in Android, you only need to execute a simple
Git pull

You can.

5. Download Code through gitweb

In addition, if you only need the code of a project on the main line, you can also use gitweb
Download: Search for a specific version using keywords in commit log, or find several newer tags to download.

Git was initially designed for Linux kernel development, so it is not good to support other platforms, especially Windows platforms, which must have cygwin. Now, thanks to msysgit
Project, we can use git without cygwin. In addition, git extensions
Is a very useful Windows Shell extension, which can be closely integrated with the resource manager, and even provides Visual Studio plug-ins. Its official website has a good description document
If you are interested, you can take a look.

For git reference documents, I recommend git magic
Here is a Chinese version of git magic.
. Git is Linux Torvalds to help manage Linux
An open source distributed version control software developed by the kernel is different from a centralized version control system such as subversion and CVS. There is only one warehouse in the centralized version control system.
Library (repository), many working directories, while in distributed version control systems such as git (other major distributed version control systems also have bitkeeper
, Mercurial
, GNU Arch
Bazaar
, Darcs
, SVK
Monotone
), Each working directory contains a complete warehouse,They support offline work, and local submission can be submitted to the server later. In theory, distributed systems are more robust than centralized single-server systems. Once a single-server system encounters a server problem, the entire system cannot run. distributed systems are generally not affected by one or two nodes.
.

Because Android is composed of multiple git projects such as kernel, Dalvik, bionic, prebuilt, and build, the android project has compiled a Python script named repo to manage the repositories of these projects in a unified manner, this makes git easier to use.

In order to get the latest sourcecode of Android, William Learned some basic operations of git and repo, sorted out how-to for how to get the android code, and pasted it today.

1. Install git

To install git on Ubuntu 8.04, you only need to set the correct update source and use apt-Get. If there is any dependency problem, let it solve it by yourself. Curl is a File Transfer tool that uses the URL syntax to work in the command line. It will be used when repo is installed later.
Sudo apt-Get install Git-core curl

2. Install Repo

First, make sure to create a/bin directory under the current user's home directory (if not), and then put it (~ /Bin) added to the PATH environment variable
Download the repo script through curl and save it ~ /Bin/repo File
Curl http://android.git.kernel.org/repo> ~ /Bin/Repo

Do not forget to grant repo executable permissions
Chmod A + x ~ /Bin/Repo

3. initialize the version Library

If you want to take down all the sourcecodes in the latest version of the current Android main line, we need repo help.
First create a directory, such ~ /Android. Use the repo init command after entering the file.
Repo init-u git: // android.git.kernel.org/platform/manifest.git

This process will last for a long time (at least you can have a good sleep). The specific time depends on the network conditions.
Finally, you will see a prompt such as repo initialized in/Android, indicating that the local version library has been initialized and contains the latest sourcecode.

If you want to use a branch instead of the Code on the main line, you need to use the-B parameter to specify the branch name, for example:
Repo init-u git: // android.git.kernel.org/platform/manifest.git-B cupcake

In another case, we only need the code of a project, such as kernel/common, without Repo. Just use git.
Git clone git: // android.git.kernel.org/kernel/common.git

This also takes a lot of time, because it will copy the entire Linux kernel code.

If you need a branch code, use git checkout. For example, if we have just obtained the kernel/common. Get code, we should first enter the common directory and then use the following command:
Git checkout origin/Android-goldfish-2.6.27-B goldfish

So we built a local Android-goldfish-2.6.27 branch named goldfish, and the code was synchronized with the android-goldgish-2.6.27. You can use git branch to list all local branches.

4. Synchronize the version Library

UseEPO sync
Command to synchronize the entire android code tree to the local device. Similarly, we can use
Repo sync project1 project2...

This command is used to synchronize several projects.

To synchronize a single project in Android, you only need to execute a simple
Git pull

You can.

5. Download Code through gitweb

In addition, if you only need the code of a project on the main line, you can also use gitweb
Download: Search for a specific version using keywords in commit log, or find several newer tags to download.

Git was initially designed for Linux kernel development, so it is not good to support other platforms, especially Windows platforms, which must have cygwin. Now, thanks to msysgit
Project, we can use git without cygwin. In addition, git extensions
Is a very useful Windows Shell extension, which can be closely integrated with the resource manager, and even provides Visual Studio plug-ins. Its official website has a good description document
If you are interested, you can take a look.

For git reference documents, I recommend git magic
Here is a Chinese version of git magic.
.

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.