Get to know GitHub in one minute

Source: Internet
Author: User

Get to know GitHub in one minute

Coincidentally, I started using GitHub, but in fact, I don't know how to make GitHub play all of its functions. Not long ago, I accidentally listened to Mr. Li Fors' introduction to GitHub and benefited a lot.

In short, Git is a distributed version control system. As the name suggests, When you edit the program code (especially when multiple people collaborate on a project), it will automatically help you implement code and version updates. This means that you do not have to manually synchronize your modified content to the cloud every time. All this work can be done automatically by Git when appropriate. This not only avoids the trouble and risks of manual synchronization, but also saves a lot of time for programmers.

I. installation and configuration

Although Git is pre-installed on all Mac and Linux computers, all pre-installed Git versions are outdated without exception. Therefore, whether you are using Mac, Linux, or Windows, you must install Github on your own.

The installation process is not described here. After the installation is complete, the most important step is to configure Git.

Run the following command:

$ Git config -- list

This command reads and displays the Git configuration file, including personal identity information and color.

Using the "git config" command, you can modify the Git configuration file to create a unique working environment. First, you must configure your user nickname and email address. This information will be embedded in all the files you submit.

Execute the following command configuration. Note that this command can only be executed once, because Git will always use this information to process all your operations in the system. If you want to use different names or e-mail addresses in a specific project, you can run this command in the project without attaching the-global option.

$ Git config -- global user. name [name]

$ Git config -- global user. email [em]

Ii. Create a copy

Before you start editing your project, you need to capture the projects hosted on the cloud from Github to your local device.

Run the following command:

$ Git clone [url]

This will create a folder structure that matches the Git repository on GitHub on your system.

GitHub prompt: If you press the "t" key in a library, you will filter and search for the file that matches the name of the file you searched. Because GitHub is a text editor, you can easily change the content and intuitively see the change results.

Before making a formal change, it is best to create a new "branch" and work in the branch. Using a branch means you can separate it from the Development Main Line and continue working without affecting the main line. This will help you make minor changes to a large project.

Run the following command:

$ Git branch feature/add-subtraction

$ Git checkout feature/add-subtraction

This will create a new branch. Working on the branch will allow you to iterate local code without worrying about messing up the main line. If you have screwed up, you only need to discard the branch and re-create a main-line-based branch.

3. Make changes

If you want to know all the files in the current directory that are not managed by git, or files that are managed by git and modified but not submitted, run the following command.

$ Git status

You can submit the changes by executing the following command:

$ Git commit src/main/java/com/github/Calculator. java-m "added subtraction"

This command is used to submit changes in the sandbox and append the message "add subtraction. It must be remembered that this change is only made on the local machine, and you must push the change to GitHub.

To submit a change, run the following command:

$ Git push origin feature/add-subtraction

Now you will see a new branch list, which lists the increase and decrease of the original branch. Finally, if you want to submit these requests to the Administrator, you need to send a pull request so that your branch can be pulled to the master branch. The pull request you send can be completed by starting a feature session about the code on GitHub.

You can also use GitHub to do many things. Now I am ready to start some new projects!

GitHub Tutorials:

Create a personal technical blog via GitHub

GitHub tutorials

Git tag management details

Git branch management

Git remote repository details

Git local Repository (Repository) Details

Git server setup and Client installation

Git Overview

Share practical GitHub tutorials

GitHub details: click here
GitHub: click here

This article permanently updates the link address:

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.