(2) Participate in Ardupilot Project programming--git Practice

Source: Internet
Author: User
Tags git commands git shell

my own Tip : (Install git Client in Windows very simple Needless to say, in Linux the installation is also very simple.

Debian/ubuntu

$ apt-get install git

Fedora

$ yum install git (up to Fedora)
$ dnf install git (Fedora and later)

Gentoo

$ emerge --ask--verbose dev-vcs/git

ArchLinux

$ pacman -S git

OpenSUSE

$ zypper install git

FreeBSD

$ cd/usr/ports/devel/git
$ make install

SOLARIS11 Express

$ pkg installdeveloper/versioning/git

OpenBSD

$ pkg_add git

Learn Git

This guide covers the basic GIT commands/Concepts for Project research: cloning, branching, committing, and pushing.

If you need more information about git, here are a lot of online resources. Here are some of the things that might be useful to you:

· Try git: a browser-based Interactive tutorial for learning git

· gitready: Tutorials at different difficulty levels

· Git SCMbook: Introduction and complete documentation

Copy the primary resource library

Note: If you want to create and test the source code (without modification) You can skip this step by simply cloning the main project repository (the next section).

"Forking" is a term that GitHub replicates a repository to its own account. The copied repository holds the information for the original project so that you can get the update from it (and you can submit the update to it in turn). If you want to submit an update to the main project you first need to create your own copy of the primary Ardupilot repository.

For more in-depth working principle of forking please see the following Chinese blog explanation https://github.com/oldratlee/translations/blob/master/ Git-workflows-and-tutorials/workflow-forking.md

Copy the primary resource library

· Log on to Githuband go to website https://github.com/ArduPilot/ardupilot.

· in the upper right corner there is a button called , "Fork":


Click the Fork button and follow the wizard.

After you complete the copy, there will be a new directory under your account, as shown in

Github.com/your-github-account-name/ardupilot

When you update your code, this replicated repository is the one you will clone and work with locally.

Clone Resource Library

"Clone" is the abbreviation for git to copy any repository to your computer. You can clone your own copy of the repository (if you need to change the source code) or the primary Ardupilot repository.

The information you need to clone a project is on the right side of the screen for each GitHub Repository home page. (The icon location may change as the site is updated)

Cloning a repository in the GitHub dialog box

Osx/linux Terminal:

L Open the terminal and go to the directory where you want to store the repository

L Clone your repository:

git clone https://github.com/your-github-account-name/ardupilot

or the main project

git clone https://github.com/ArduPilot/ardupilot

Windows (GitHub GUI):

L Browser opens the page where the diydrones/ardupilot Repository is located

L Click the Clone in Desktop button (the button may change as the site is updated)


Compiling code (Programs)

Ardupilot supports compiling many different target codes (vehicle and autopilot hardware) in Linux, Windows, and Mac OSX. See buildingthecode for information on how to compile a specific target code. (Chinese blog)

Build branches and update some code

Branching is the development of different paths that are independent of each other, or can be combined into a simple (often named "Mashter") branch. Refer to this article for more information on some of the resources under the Git section of this article. In that part of the tutorial, you can create a branch and change some code.

The name of the branch is up to you, but using a descriptive phrase can be helpful for branching names in this tutorial "apm_git_tutorial"

Osx/linux Terminal Commands

These commands assume that your current working directory is in the root directory of your cloned repository.

Note: These commands can also be Windows If you use git clients (such as "Git Shell" Utilities and GitHub in the Windows has been installed ).

1. Create a branch

Git checkout-b apm_git_tutorial

2. Change some code. In this tutorial, open tools/git_test/git_success.txt through the editor   , add your name to the end of the file, save the file. 

3. Review your changes to some files by checking the status:

git status

4. Submit your work to the branch and add your changes in GIT history:

git add tools/git_test/git_success.txt git commit-m ' Added name to Git_success.txt '
my own Tip : # The command on the official website of the above command is  Add Tools/git_test/git_success. txt
file name git_success . txt in git should be capitalized, in the downloaded repository git_success . txt the file name may not be the same as the official command
First execution  commit-' Added name to Git_success.txt '
The following error may be reported, follow the prompts to configure

The commit success may appear as shown below


5. Push your branch to GitHub. This operation will copy your local branch to a new branch of GitHub. Push branches are prerequisites for working with other people on GitHub, or for submitting patches to the official version. Suppose your source is the remote End name () of the GitHub repository you copied.

Git push Origin head:apm_git_tutorial

When you run the command, you will be asked to enter the user name and password for the GitHub website account. Successful push results are as follows,


Log in again or refresh Gihub and you'll find that there are more branches and changes you've just pushed in the Web page, as shown in


Keep updating .....


(2) Participate in Ardupilot Project programming--git Practice

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.