Github how to use

本文介绍了如何在GitHub上创建并合并Pull Request的过程,包括如何提交更改、编写commit消息、打开Pull Request及合并请求等内容。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Make a commit

On GitHub, saved changes are called commits. Commits are pretty glorious, because a bunch of them together read like the history of your project.

Each commit has an associated commit message, which is a description explaining why a particular change was made. Thanks to these messages, you and others can read through commits and understand what you’ve done and why.

You should still be on the code view for your readme-edits branch, now make some changes!

To commit changes
  1. Click the README file.
  2. Click Edit.
  3. In the editor, write some text, tell a bit about yourself.
  4. Write a commit message that describes your changes.

commitcommit

Click Commit changes. Now these changes have been made to the README file on your readme-edits branch and now this branch contains different content and commits than master (as it should!).

Open a Pull Request

Pull Requests are the heart of collaboration on GitHub. When you make a pull request, you’re proposing your changes and requesting that someone pull in your contribution - aka merge them into their branch. GitHub’s Pull Request feature allows you to compare the content on two branches. The changes, additions and subtractions, are shown in green and red and called diffs(differences).

As soon as you make a change, you can open a Pull Request. People use Pull Requests to start a discussion about commits (code review) even before the code is finished. This way you can get feedback as you go or help when you’re stuck.

By using GitHub’s @mention system in your Pull Request message, you can ask for feedback from specific people or teams, whether they’re down the hall or 10 time zones away.

You can even open, as we’re doing here, a Pull Request in your own repository and merge it yourself. It’s a great way to learn to process before working on larger projects.

Create a Pull Request for changes to the README

Click on the image for a larger version

StepScreenshot
Click the  Pull Request icon on the sidebar, then from the Pull Request page, click the green New pull request button.create pr
Select the branch you made,readme-edits, to compare withmaster (the original).branch
Look over your changes in the diffs on the Compare page, make sure they’re what you want to submit.diff
When you’re satisfied that these are the changes you want to submit, click the big green Create Pull Request button.create-pull
Give your pull request a title and since it relates directly to an open issue, include “fixes #” and the issue number in the title. Write a brief description of your changes.pr-form

When you’re done with your message, click Send Pull Request!


Tip: You can use emoji and drag and drop images and gifs onto comments and Pull Requests.

Merge your Pull Request

It’s time to bring your changes together – merge your readme-edits branch into the master branch.

  1. Click the green button to merge the changes into master.
  2. Click Confirm merge.
  3. Go ahead and delete the branch, since its changes have been incorporated, with the Delete branch button in the purple box.

mergedelete

If you revisit the issue you opened, it’s now closed! Because you included “fixes #1” in your Pull Request title, GitHub took care of closing that issue when the Pull Request was merged!

Celebrate!

You’ve learned to make a pull request on GitHub! :tada: :octocat: :zap:

For your humblebrag, here are the things you accomplished in this tutorial: created a repository, branch, issue, and pull request, then merged a pull request! Show off your new contribution squares!

If you want to learn more about the power of pull requests, we recommend reading the GitHub Flow Guide. You might also visit GitHub Explore and get involved in an Open Source project :octocat:




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值