github第一次使用--创建hello-world

1.Create a Repository(创建一个仓库)

A repository is usually used to organize a single project. Repositories can contain folders and files, images, videos, spreadsheets, and data sets – anything your project needs. We recommend including a README, or a file with information about your project. GitHub makes it easy to add one at the same time you create your new repository. It also offers other common options such as a license file.
Your hello-world repository can be a place where you store ideas, resources, or even share and discuss things with others.

存储库通常用于组织单个项目。 存储库可以包含文件夹和文件,图像,视频,电子表格和数据集 - 您的项目需要的任何内容。 我们建议包括README或包含项目信息的文件。 GitHub可以在创建新存储库的同时轻松添加一个。 它还提供其他常见选项,例如许可证文件。

您的hello-world存储库可以是存储想法,资源,甚至与他人共享和讨论事物的地方。

To create a new repository(具体的做法)

1. In the upper right corner, next to your avatar or identicon, click and then select New repository.
2. Name your repository hello-world.
3. Write a short description.
4. Select Initialize this repository with a README.

  1. 在右上角,在您的头像或identicon旁边,单击,然后选择新建存储库。
    在这里插入图片描述
  2. 将您的存储库命名为hello-world。
  3. 写一个简短的描述。
  4. 选择使用README文件初始化此存储库。
    在这里插入图片描述

2.Create a Branch(创建一个分支)

Branching is the way to work on different versions of a repository at one time.

By default your repository has one branch named master which is considered to be the definitive branch. We use branches to experiment and make edits before committing them to master.

When you create a branch off the master branch, you’re making a copy, or snapshot, of master as it was at that point in time. If someone else made changes to the master branch while you were working on your branch, you could pull in those updates.

分支是一次在不同版本的存储库上工作的方式。

默认情况下,您的存储库有一个名为master的分支,它被认为是权威分支。 在将它们提交给master之前,我们使用分支进行实验并进行编辑

当您从主分支创建分支时,您正在制作主分支的副本或快照,就像在那个时间点那样。 如果其他人在您的分支机构上工作时对主分支进行了更改,则可以引入这些更新。最后所有的更新都会合并到这个分支奥

This diagram shows:

  • The master branch
  • A new branch called feature (because we’re doing ‘feature work’ on this branch)
  • The journey that feature takes before it’s merged into master

该图显示:

  • 主分支
  • 一个名为feature的新分支(因为我们在这个分支上做’功能工作’)
  • 功能在合并到主服务器之前所经历的旅程
    在这里插入图片描述
    Have you ever saved different versions of a file? Something like:
  • story.txt
  • story-joe-edit.txt
  • story-joe-edit-reviewed.txt
  • Branches accomplish similar goals in GitHub repositories.

Here at GitHub, our developers, writers, and designers use branches for keeping bug fixes and feature work separate from our master (production) branch. When a change is ready, they merge their branch into master.

你有没有保存过不同版本的文件?就像是

  • story.txt
  • story-joe-edit.txt
  • story-joe-reviewed.txt
    分支机构在GitHub存储库中实现了类似的目标。

在GitHub,我们的开发人员,编写人员和设计人员使用分支来保持错误修复和功能工作与主(生产)分支分开。 当更改准备就绪时,它们将其分支合并到主服务器中。

To create a new branch(创建一个新分支)

  • Go to your new repository hello-world.
  • Click the drop down at the top of the file list that says branch: master.
  • Type a branch name, readme-edits, into the new branch text box.
  • Select the blue Create branch box or hit “Enter” on your keyboard.
    Now you have two branches, master and readme-edits. They look exactly the same, but not for long! Next we’ll add our changes to the new branch.

转到新的存储库hello-world。
单击文件列表顶部的下拉列表:master:master。
在新分支文本框中键入分支名称readme-edits。
选择蓝色的创建分支框或按键盘上的“Enter”。
现在你有两个分支,master和readme-edits。它们看起来完全一样,但时间不长!接下来,我们将更改添加到新分支。

在这里插入图片描述

3.Make and commit changes(制作并提交更改)

Bravo! Now, you’re on the code view for your readme-edits branch, which is a copy of master. Let’s make some edits.

On GitHub, saved changes are called commits. Each commit has an associated commit message, which is a description explaining why a particular change was made. Commit messages capture the history of your changes, so other contributors can understand what you’ve done and why.

好样的! 现在,您正在阅读readme-edits分支的代码视图,该分支是master的副本。 我们来做一些编辑。

在GitHub上,保存的更改称为提交。 每个提交都有一个关联的提交消息,这是一个解释为什么进行特定更改的描述。 提交消息可捕获更改的历史记录,因此其他贡献者可以了解您已完成的操作和原因。

Make and commit changes

  1. Click the README.md file.
  2. Click the pencil icon in the upper right corner of the file view to edit.
  3. In the editor, write a bit about yourself.
  4. Write a commit message that describes your changes.
  5. Click Commit changes button.

制作并提交更改

  • 单击README.md文件
  • 单击文件视图右上角的铅笔图标进行编辑。
  • 在编辑器中,写下一些关于你自己的内容
  • 编写描述更改的提交消息。
  • 单击提交更改按钮。
    在这里插入图片描述
    These changes will be made to just the README file on your readme-edits branch, so now this branch contains content that’s different from master.

这些更改将仅对readme-edits分支上的README文件进行,因此现在此分支包含的内容与master不同。
在这里插入图片描述
更改完后的样子。

4.Open a Pull Request(打开拉取请求)

Nice edits! Now that you have changes in a branch off of master, you can open a pull request.

Pull Requests are the heart of collaboration on GitHub. When you open a pull request, you’re proposing your changes and requesting that someone review and pull in your contribution and merge them into their branch. Pull requests show diffs, or differences, of the content from both branches. The changes, additions, and subtractions are shown in green and red.

As soon as you make a commit, you can open a pull request and start a discussion, even before the code is finished.

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 pull requests in your own repository and merge them yourself. It’s a great way to learn the GitHub flow before working on larger projects.

很好的编辑! 现在您在master的分支中有更改,您可以打开pull请求。

Pull Requests是GitHub上合作的核心。 当您打开拉取请求时,您提出了更改并请求某人审核并提取您的贡献并将其合并到他们的分支中。 拉请求显示来自两个分支的内容的差异或差异。 更改,添加和减少以绿色和红色显示。

提交后,即使在代码完成之前,您也可以打开拉取请求并开始讨论

通过在拉取请求消息中使用GitHub的@mention系统,您可以询问特定人员或团队的反馈,无论他们是在大厅还是10个时区之外。

您甚至可以在自己的存储库中打开pull请求并自行合并。 在开展大型项目之前,这是学习GitHub流程的好方法。

Open a Pull Request for changes to the README(给READNME打开一个拉取请求)

stepscreenshots
Click the Pull Request tab, then from the Pull Request page, click the green New pull request button.在这里插入图片描述
In the Example Comparisons box, select the branch you made, readme-edits, to compare with master (the original).在这里插入图片描述
Look over your changes in the diffs on the Compare page, make sure they’re what you want to submit.在这里插入图片描述
Give your pull request a title and write a brief description of your changes.在这里插入图片描述

When you’re done with your message, click Create pull request!

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

上面是GitHub上给的官方教程,但是并不详细,下面我贴出自己的做法
在这里插入图片描述
首先点New pull request
然后观察变化
在这里插入图片描述
确认的话,点击Create pull request,即你的改变确认了,然后准备向别人发起请求,请求人家同意你的修改
在这里插入图片描述
描述具体的原因,点击create pull request,就ok了
在这里插入图片描述

5.Merge your Pull Request(合并你的pull请求)

In this final step, it’s time to bring your changes together – merging your readme-edits branch into the master branch.

  • Click the green Merge pull request button to merge the changes into master.
  • Click Confirm merge.
  • Go ahead and delete the branch, since its changes have been incorporated, with the Delete branch button in the purple box.

在最后一步中,是时候将您的更改结合在一起 - 将您的自述编辑分支合并到主分支中。

  • 单击绿色合并拉取请求按钮以将更改合并到主文件中。
  • 单击确认合并
  • 继续删除分支,因为它的更改已合并,紫色框中的删除分支按钮。
  • 在这里插入图片描述
  • 在这里插入图片描述

Celebrate!

By completing this tutorial, you’ve learned to create a project and make a pull request on GitHub!

Here’s what you accomplished in this tutorial:

  • Created an open source repository
  • Started and managed a new branch
  • Changed a file and committed those changes to GitHub
  • Opened and merged a Pull Request
  • Take a look at your GitHub profile and you’ll see your new contribution squares!

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.

Tip: Check out our other Guides, YouTube Channel and On-Demand Training for more on how to get started with GitHub.

庆祝!
通过完成本教程,您已经学会了创建项目并在GitHub上发出拉取请求!

以下是您在本教程中完成的内容:

  • 创建了一个开源存储库
  • 开始并管理一个新的分支
  • 更改了文件并将这些更改提交给GitHub
  • 打开并合并了一个Pull Request
  • 看看你的GitHub个人资料,你会看到你的新贡献正方形!

要了解有关Pull请求功能的更多信息,我们建议您阅读GitHub流程指南。 您也可以访问GitHub Explore并参与开源项目。

提示:查看我们的其他指南,YouTube频道和按需培训,了解有关如何开始使用GitHub的更多信息。

希望一起进步和交流!!!有问题留言,我们一起探讨。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值