GitHub It is a development platform for developers. GitHub is a development platform inspired by the way developers work, from open source to business, to be able to manage and view code, manage projects, and develop software with millions of other developers. GitHub provides free account and payAccounts, free accounts can only create open source projects, and paid accounts can create private projects. If you are a student, if you are a student, you can apply in the official network with the mailbox assigned by the school. After the application is passed, it can also create private projects.
To complete this tutorial, you need a GitHub account to register on the official website.
The following are the basic contents of GitHub, such asWarehouse、branch、Submission、Request merger。Here, take HelloWorld warehouse as an example, and learn other contents of GitHub.
1、Create a warehouse
A warehouse is usually used to organize a single project. A warehouse can contain folders and files, pictures, videos, spreadsheets and data sets, and anything that is needed by the project. A README file is recommended under each warehouse, or a file containing project information. You can store what you want in the warehouseLaws and resources can even share and discuss problems with others. It
Create a new warehouse
1、Click + on the left column or head, then click on the new warehouse. It
2、The name of the warehouse, we set it to HelloWorld.
3、Write a simple description to the warehouse and introduce a few words about the project.
4、When selecting initialization repository, create README file.
5、Click create the warehouse to complete the creation of the warehouse.
2、Create a branch
Branching is a way to handle different versions of repository at a time. By default, there is a branch named master under the warehouse. This is our main branch and the final version. We use other branches to carry out experiments. Before submitting to the main branch, we can edit the branches.Operation. When we create a branch on the main branch, it is equivalent to our copy or snapshot from the main branch, so that when we work on our own branch, if the others have changed the main branch, we can update the code through the Pull operation. Every branch is independent, oneA project can have multiple branches, each of which develops its own module, and finally merges it to the main branch.
The following diagram shows
1、The main branch (Master).
2、The new branch is called feature, and each branch is an extension of function.
3、feature The whole process of the merging of the branches by master.
When you create a branch on the main branch, it is equivalent to copy or snapshot. If you change the main branch when you work on the branch, you can update it to the latest code through pull.
Have you saved a different version of the file, such as:
The branch is used to solve such a thing. On GitHub, developers, authors, and designers use branches to separate bug’s repair and development functions from our main branch. When a change is ready, we merge the corresponding branches to the main branch.
Create a new branch
1、Enter the HelloWorld warehouse we just created.
2、Click the branch master in the top file list.
3、Enter a branch name in the new branch text box, readme-edits.
4、Select the blue to create a branch box or click enter.
Now there are two branches, master and readme-edits. They look exactly the same, but not too long! Next, we will add new changes to the new branch.
3、Modification and submission of modification
The branch of readme-edits that we are in now is a copy of master. Next let’s make some editors. On GitHub, the saved changes are called submissions, and each submission has an associated submit message, which is a description of the changes you made.When you submit a change, other contributors can know what you have done through the description.
Modification and submission of modification
1、Click the README.md file.
2、Click on the second Pencil Icon on the right to make changes.
3、In the editing area, write an introduction to yourself.
4、Fill in the submission information and describe the update.
5、Click the change button.
These changes are aimed at the README file in the current readme-edits branch, and now the contents of the branch are different from those on master.
4、Request merge branch (PR)
Now that we have changed the branch, we can carry out the Pull Request for the main branch. Pull Request is the core of GitHub cooperation. When you issue a Pull Request, you are asking for your change, asking for trial.Check and merge your changes (Contributions) into their branches. Pull Request shows the difference between the contents of the two branches. These changes are expressed in green, and the reduced content is expressed in red.
When you do the work, you can commit, by presenting Pull Request and starting the discussion, you can use @ at Pull Request to ask for a specific person or team to review it.
To change the README file, open the Pull Request
1、Click on the Pull Request option, and then click the green New Pull Request button on the Pull Request page.
Select the branch that we created, readme-edits, for comparison with master.
Check the changes of the files to make sure that they are submitted.
When checked, there is no mistake. You can click on the green button to create a Pull Request.
After clicking, give the title and description of this Pull Request.
After the above is completed, click the green button to create.
5、Merge Pull Request
The last step is to merge the previous changes to the main branch, that is, to merge the readme-edits branch onto the master branch.
1、Click the green button and merge to master.
2、Click confirm merge.
Here you have learned how to create warehouses on GitHub and how to contribute to others’ projects.
You completed the following homework in this study.
1、Create an open source project.
2、Create and merge branches.
3、Change the contents of the file and submit the changes to GitHub.
4、The Pull Requet is proposed and a Pull Request is merged.
PS：If you think the article is good, please share it with me, which is the biggest support for me.
Java Summary of learning experience
SSHPassword free login under configuration – Linux
Java Learning materials