Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to create GitHub

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "how to create GitHub". The content in the article is simple and clear, easy to learn and understand. Please follow the editor's train of thought to study and learn "how to create GitHub".

What is GitHub?

GitHub is a code hosting platform for version control and collaboration. It allows you to work on the same project with others anywhere. This tutorial introduces you to the basic functions of GitHub, such as repositories, branching, submission, and pull requests. You will create your own Hello World repository, and you will learn the workflow of GitHub's pull request, a popular way to create and review code.

It doesn't matter if there's no code.

To complete this tutorial, you need a GitHub account and Internet access. You don't need to know how to write code, use the command line, or install Git (the version control software GitHub is built on top of Git).

Tip: open this guide in a separate browser window (or tab) so that you can see it when you complete the steps in the tutorial.

Step 1: create a warehouse

A warehouse is often used to manage a project, and the repository can contain folders and files, images, videos, spreadsheets, and datasets-anything your project needs. We recommend that you include a readme, or a file containing your project information, in the repository. GitHub makes it easy to add a file while creating a new repository. It also provides other common options, such as license files.

Start to create a warehouse

Next to your avatar in the upper right corner of the GitHub website, click the + sign and select "New repository"

Name your warehouse after "hello_world"

Write a short introduction

Select a README file to populate your warehouse

Click Create repository.

Step 2: create a branch

Branching is a method of dealing with different versions of the warehouse file at the same time.

By default, your warehouse has a branch called "master", which is considered the final branch. We experimented and edited the project using the branch structure before submitting it to "master".

When you create another branch outside the main branch, you make a copy, or snapshot, of the current main branch. If someone else makes changes to the main branch while you are dealing with the branch, you can get updates at the right time.

As shown in the following figure:

Main branch master

A new branch called "feature" (because we do "feature work" on this branch)

The experience of the "feature" branch before it was integrated into the main branch master

Have you ever saved different versions of the same file? It's like this:

Story.text

Story-joe-edit.txt

Story-joe-edit-reviewed.txt

Branches can accomplish similar goals in the GitHub repository.

At GitHub, our developers, writers, and designers use branches to separate repair bug and feature work from our main (production) branch. When the changes are ready, they merge the branches into the main branch master.

Create a branch by hand

Open your new warehouse "hello_world"

Click the drop-down list at the top of the file list, which displays the branch: master

Type the branch name readme-edits in the new branch text box

Select the blue create Branch box or press enter on the keyboard

There are now two branches, master and readme-edits. They look exactly the same, but it's only temporary! Next, we will add the changes to the new branch.

Step 3: make changes and submit

Okay! Now, in the code interface of the readme-edits branch, it is a copy of master. Let's do some editing.

On GitHub, saved changes are called commit. Each submission has an associated commit message, which is a description of why specific changes are made. The submit message captures your change history so that other contributors can understand what you are doing and why.

Make changes and submit

Click the README.md file

Click the pencil icon in the upper-right corner of the file view to edit.

Write a little self-introduction in the editing area

Click "Commit changes" button

These changes will only apply to the README file in your readme-edits branch, so now the content of that branch is different from that of the main branch.

Step 4: open a pull request

Beautiful! Now that you have made changes in the branch of master, you can open the pull request.

Pull requests are at the core of GitHub collaboration. When you open a pull request, you are asking someone to review and accept your proposed changes and merge them into their branches. The pull request shows the difference in content from the two branches. Changes, additions and deletions to the content will be displayed in green and red.

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

Using GitHub's https://help.github.com/en/github/writing-on-github/about-writing-and-formatting-on-github#text-formatting-toolbar in your pull request message, you can ask for feedback from specific people or teams, whether they are on the other side of the living room or outside 10 time zones.

You can even open pull requests in your own repository and merge them yourself. This is a good way to learn the GitHub process before embarking on a large project.

Open the pull request for modification of README file by hand

Click on the picture to see the larger picture:

Click the Pull Request tab, then from the Pull Request page, click the green New Pull Request button.

In the sample comparison box, select the branch readme-edits you created to compare with master (the original version).

Review your changes in the differences on the comparison page to make sure they are what you want to submit.

When you are sure that these are the changes you want to commit, click the green Create Pull Request button.

Give your pull a title and write a short description of the change.

When you are finished, click "Create pull request"!

Note: you can use emoticons or drag and drop images, animations, etc., in the comment area or pull request.

Step 5: merge your pull request

As a final step, it's time to merge the changes in your "readme-edits" branch into the "master" main branch.

Click the green Merge pull request button to merge the changes into master.

Click "Confirm merge"

When the changes in the branch have been merged, click the "Delete branch" button in the purple box to delete the branch

Thank you for your reading, the above is the content of "how to create GitHub", after the study of this article, I believe you have a deeper understanding of how to create GitHub, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report