Python3-the most basic operations on GitHub

Source: Internet
Author: User
Tags time zones

Read Catalogue

    1. Introduced
    2. What is GitHub?
    3. Create a repository
    4. Create a branch
    5. Do a Commit
    6. Open Pull Request
    7. Merge Pull Requests

First, Introduction

  Hello World Project is a long history of computer programming tradition. This is a simple exercise that allows you to start learning when you are learning something new. Let's start using github!

You will learn how to:

    • Creating and using repositories
    • Start and manage a new branch
    • Make changes to the file and push it to GitHub as a commit
    • Open and Merge pull requests

second, what is GitHub?

GitHub is a code hosting platform for version control and collaboration. It allows you and others to work together wherever you are.

This tutorial teaches you a basic knowledge of GitHub, such as Storage Library , Branch , Submit and the Pull Request . You'll create your own Hello World repository and learn about GitHub's pull request workflow, which is a popular way to create and check your code.

No coding required

to complete this tutorial, you need to github.com account and Internet access rights. You don't need to know how to encode, use the command line or install Git (based on version control software GitHub).

Tips: Open this guide in a separate browser window (or tab) so that you can see it as you complete the steps in this tutorial.

Step 1: Create a repository

a Library typically used to host a single project. a repository can contain folders and files, images, videos, spreadsheets, and datasets-anything your project requires. we recommend including a readme or a file containing project information.

GitHub can easily add one while creating a new repository. It also provides other common options, such as license files.

you a hello-world a repository can be a place to store ideas, resources, and even share and discuss things with others.

Create a new repository
    1. In the upper-right corner, next to your avatar or Identicon, click then select New repository.
    2. Name your hello-world repository .
    3. Write a short description.
    4. Select Initialize this repository with the Readme file .

Click Create a repository .

2nd step. Create a branch

Branch is a way to process different versions of a repository at a time.

by default, your repository has a branch master named Branch , the branch is considered an authoritative branch. We use branches to experiment and edit before committing master .

When you create a branch master on a branch office , you are making the master A copy or snapshot of the point in time . you master can extract these updates if other people have made changes to the branch while they are working on your branch office .

The graph shows:

    • the master Branch
    • a new branch feature called. (because we do ' special work ' on this branch)
    • featureit melts before The Journeymaster

have you saved a different version of the file? It's like:

    • story.txt
    • story-joe-edit.txt
    • story-joe-edit-reviewed.txt

Branch offices achieve similar goals in the GitHub repository.

at GitHub, our developers, writers and designers use branches to maintain bug fixes and functionality to work with our master (production) branches apart . when the changes are ready, they merge their branches into master .

Create a new branch
    1. go to the new repository hello-world .
    2. Click the drop-down list at the top of the file list : Master:master .
    3. readme-editsin the New branch text box Type the name of the branch .
    4. Select the Blue Create a branch box or press Enter on your keyboard.

Now you have two branches, master and the readme-edits . They look exactly the same, but they won't be long! Next, we add the changes to the new branch.

3rd step. Make and submit changes

Good for you ! Now, in the readme-edits Code View of the branch , this is a copy master . Let's do some editing.

on GitHub, the saved changes are called Submit . Each commit has an associated commit message , which is a description of why a particular change was made. The commit message captures the history of the change, so other contributors can understand what you've done and why.

make and submit changes
    1. Click the README.md file.
    2. Click The pencil icon in the upper-right corner of the file view to edit.
    3. In the editor, write a little bit about yourself.
    4. Write a commit message that describes the change.
    5. Click Commit Changes button.

These changes will only readme-edits the Readme file on the branch , so this branch now contains different content master .

Step 4. Open Pull Request

Very good editor! Now that you have changes in your branch master , you can open a pull request .

pull Requests is at the heart of the collaboration on GitHub. when you open a pull request , you make a change and ask someone to review and extract your contributions and merge them into their branch. Pull requests show the difference or difference of content from two branches . changes, additions, and decreases are shown in green and red.

Once submitted, you can open the pull request and start the discussion even before the code is complete.

by using GitHub's @mention system in a pull request message , You can ask for feedback from a specific person or team, Whether they are outside the hall or 10 time zones.

you can even open pull requests in your own repository and merge them yourself. This is a great way to learn about GitHub flow before you start a large project.

Open Pull Request to change the Readme

Click on the image to see a larger map

Step
Click  ,   Pull request tab, and from the Pull request page, click the green   new Pull Request button.
in "  Example comparison" box, select the branch you created readme-edits to be associated with the master (original) for comparison .
Review the differences in the diff page to make sure that they are the content you want to submit.
If you are satisfied with the changes you are submitting, click the green   Create pull Request button.
provide a title for your pull request and write a brief description of your changes.

when the message is complete, click Create pull Request " !

Tips : You can use emoji and drag and drop pictures and gif to comments and introduce requests.

Step 5: Merge your pull requests

in the final step, it's time to combine your changes-put your readme-edits Branch merge to master the branch.

    1. Click the Green Merge Pull Requests button to merge the changes into the master .
    2. Click Confirm Merge .
    3. continue to delete the branch because its changes have been merged, in purple box of the Delete Branch button.

Congratulations on your first revision success!

Python3-the most basic operations on GitHub

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.