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 get started with GitHub quickly

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article is about how to get started with GitHub quickly. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

GitHub is a hosting platform for open source and private software projects, because it only supports Git as the only version library format for hosting, hence the name GitHub.

GitHub was officially launched on April 10, 2008. In addition to Git code repository hosting and basic Web management interface, it also provides subscription, discussion group, text rendering, online file editor, collaboration graph (report), code snippet sharing (Gist) and other functions. At present, there are a large number of managed versions, and there are many well-known open source projects, such as Ruby on Rails, jQuery, python and so on.

Register GitHub and start an item

When you start a new project on GitHub, you must first create an account with your email address.

Then, when verifying the mailbox, the user will automatically log in to their GitHub account.

1. Create a warehouse

After that, we will be taken to a page used to create the warehouse repository. The warehouse stores all project files, including revision history. The warehouse can be public or private. The open warehouse can be viewed by anyone, but only those granted permission by the project owner can submit changes to the warehouse. On the other hand, private warehouses provide additional control over who the project can be made visible to. Therefore, public repositories are suitable for open source software projects, while private repositories are mainly suitable for private or closed source projects.

Fill in "warehouse name Repository Name" and "short description Short Description". Select initialize Initialize this repository with a README with a README file. Finally, click the "create warehouse Create Repository" button at the bottom.

two。 Add Branch

In GitHub, a branch branch is a way to operate multiple versions of a single repository at the same time. By default, any single repository created is assigned a branch called "MASTER", which is considered to be the last branch. In GitHub, branches can play a role in experimenting and editing the warehouse before being merged into the trunk master (the last branch).

In order to adapt the project to everyone's needs, it is usually necessary to add several extra branches to match different projects. The current state of creating a branch on the primary branch is the same as when replicating the primary branch.

Creating a branch is similar to saving a single file in different versions. It is achieved by renaming tasks performed on a specific warehouse.

Branches have also been shown to be effective in maintaining bug fixes and feature additions. After making the necessary modifications, these branches are merged into the main branch.

Create a branch after creating the warehouse:

In this example, click the warehouse name "Hello-World" to jump to your new warehouse. Click the "Branch:Master" button at the top and you will see a drop-down menu with a blank field for the branch name. Enter the branch name, and in this example we enter "readme-edits". Press enter or click the blue "create Branch create branch" box. This successfully creates two branches: master and readme-edits.

Git project operation 1. Modify the project file and submit

This step provides guidance on how to change the warehouse and save the changes. On GitHub, submitting a commit is defined as the meaning of saved changes. Each commit is associated with a submission information commit message that contains a history of saved changes and why those changes were made. This makes it easy for other contributors to know the changes you have made and why.

To make and commit changes to the warehouse, perform the following steps:

Click the warehouse name "Hello-World". Click the pencil icon in the upper right corner to view and edit the file.

In the editor, write something to make sure you can make changes. Make a brief summary in the submit message commit message field to explain why and how to make the change. Click the submit changes commit changes button to save the changes. Note that these changes affect only the readme-edits branch, not the main branch.

two。 Open a pull request

Pull request is a feature that allows contributors to propose and request someone to review and merge certain changes into their branches. The pull request also shows the difference between several branches (diffs). Changes, additions, and deletions are usually represented in red and green. Once the submission is complete, the pull request can be opened, even if the code is not yet complete.

Open a pull request:

Click the pull request pull requests tab. Click the New pull request new pull requests button. Select the readme-edits branch to compare with the master branch.

Identify the request and make sure that this is what you want to submit. Click the create pull request green button and enter a title. Open a pull request in github repository presses enter. The user can verify these actions by trying to create and save the pull request.

3. Merge pull request

The final step is to merge the readme-edits branch and the master branch together. If there is no conflict between the readme-edits branch and the master branch, the button for the merge pull request merge pull request is displayed. When merging pull, it is necessary to ensure that the comment comment and other fields are filled in correctly. Merge pull:

Click the merge pull request merge pull request button. Confirm the merge. Press the purple delete branch button to delete the readme-edits branch because it is already included in the master branch. (PS: if you are merging pull requests submitted by others, you do not need and cannot delete the branches of others that have been merged. )

Thank you for reading! This is the end of the article on "how to get started with GitHub quickly". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

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

Development

Wechat

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

12
Report