Introduction | GitHub is an online platform designed to facilitate code hosting, version control, and collaboration between individuals working on a common project. Through the platform, you can work on projects (host and review code, manage projects and co-develop software with other developers around the world) anytime and anywhere. The GitHub platform provides project processing capabilities for both open source and private projects. |
GitHub is an online platform designed to facilitate code hosting, version control, and collaboration between individuals working on a common project. Through the platform, you can work on projects (host and review code, manage projects and co-develop software with other developers around the world) anytime and anywhere. The GitHub platform provides project processing capabilities for both open source and private projects.
Features for team project processing include: GitHub Flow> and GitHub Pages. These features make workflows easy for teams that need to deploy regularly. GitHub Pages, on the other hand, provides pages for showcasing open source projects, displaying resumes, hosting blogs, and more.
GitHub also provides the necessary tools for personal projects so that personal projects can be handled easily. It also makes it easier for individuals to share their projects with the world.
Register GitHub and start a projectWhen starting a new project on GitHub, you must first create an account with your email address.
Then, when verifying their email, the user will automatically be logged into their GitHub account.
1. Create a warehouseAfter that, we will be taken to a page for creating a warehouse repository. The repository stores all project files including revision history. Repositories can be public or private. Public repositories can be viewed by anyone, but only those authorized by the project owner can submit changes to the repository. Private repositories, on the other hand, provide additional control over who the project is 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 the "Repository Name" and "Short Description".
Check Initialize this repository with a README file.
Finally, click the "Create Repository" button at the bottom.
In GitHub, branching is a way to operate various versions of a single warehouse at the same time. By default, any single repository created is assigned a branch named "MASTER", which is considered the last branch. In GitHub, branches can play a role in experimenting and editing the repository before being merged into master (the final branch).
In order to adapt the project to everyone's needs, it is usually necessary to add several additional branches to match different projects. The current state when creating a branch on the master branch and copying the master branch is the same.
Creating a branch is similar to saving a single file in different versions. It does this by renaming tasks executed on a specific repository.
Branches have also proven effective in keeping work on bug fixes and feature additions. After making the necessary changes, these branches are merged into the main branch.
Create a branch after creating the warehouse:
In this example, click on 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 to fill in the branch name.
Enter the branch name, in this example we enter “readme-edits“.
Press Enter or click on the blue "create branch" box.
This successfully creates two branches: master and readme-edits.
This step provides guidance on how to make changes to the repository and save the changes. On GitHub, commit is defined as saving changes. Each commit is associated with a commit message that contains a history of saved changes and why those changes were made. This makes it easy for other contributors to know what changes you made and why.
To make changes to the repository and commit the changes, follow these steps:
Click on 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 commit message field to explain why and how the changes were made.
Click the commit changes button to save the changes.
Note that these changes only affect the readme-edits branch, not the main branch.
Pull request is a feature that allows contributors to propose and request someone to review and merge certain changes into their branch. The pull request also shows diffs for several branches. Changes, additions, and deletions are usually represented by red and green colors. A pull request can be opened once the commit is complete, even if the code is not yet complete.
Open a pull request:
Click on the pull requests tab.
Click the new pull requests button.
Select the readme-edits branch to compare with the master branch.
Confirm the request and make sure 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
Press the Enter key.
Users can verify these actions by trying to create and save a pull request.
The last 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, a merge pull request button will be displayed.
When merging pulls, it is necessary to ensure that the comment and other fields are filled in correctly. Merge pull:
Click the merge pull request button to merge the pull request.
Confirm the merge.
Press the purple Delete Branch button to delete the readme-edits branch since it is already included in the master branch. (PS: If you are merging pull requests submitted by others, you do not need to and cannot delete the merged branches of others.)
The above is the detailed content of Get started quickly with GitHub. For more information, please follow other related articles on the PHP Chinese website!