原文链接:点击打开链接

阅读官方文档一方面是最权威的讲解,另一方面又能提高你的英语阅读能力,同时让你有一个进步的满足感,英语基础不好的同学可以结合翻译阅读学习,或者直接观看翻译(下方为翻译)

The Hello World project is a time-honored tradition in computer programming. It is a simple exercise that gets you started when learning something new. Let’s get started with GitHub!

You’ll learn how to:

  • Create and use a repository
  • Start and manage a new branch
  • Make changes to a file and push them to GitHub as commits
  • Open and merge a pull request

What is GitHub?

GitHub is a code hosting platform for version control and collaboration. It lets you and others work together on projects from anywhere.

This tutorial teaches you GitHub essentials like repositories, branches, commits, and Pull Requests. You’ll create your own Hello World repository and learn GitHub’s Pull Request workflow, a popular way to create and review code.

No coding necessary

To complete this tutorial, you need a GitHub.com account and Internet access. You don’t need to know how to code, use the command line, or install Git (the version control software GitHub is built on).

Tip: Open this guide in a separate browser window (or tab) so you can see it while you complete the steps in the tutorial.

Step 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.

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.

Click Create repository.

Step 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.

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

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.

To create a new branch

  1. Go to your new repository hello-world.
  2. Click the drop down at the top of the file list that says branch: master.
  3. Type a branch name, readme-edits, into the new branch text box.
  4. 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.

Step 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.

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.

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.

Step 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.

Open a Pull Request for changes to the README

Click on the image for a larger version

Step Screenshot
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.
When you’re satisfied that these are the changes you want to submit, click the big green Create Pull Request button.
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.

Step 5. Merge your Pull Request

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

  1. Click the green Merge pull request 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.

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.

以下为翻译内容:

Hello,World!

简介

GitHub是一个通过Git进行版本控制的软件源代码托管服务,由GitHub公司(曾称Logical Awesome)的开发者Chris Wanstrath、PJ Hyett和Tom Preston-Werner使用Ruby on Rails编写而成。
GitHub同时提供付费账户免费账户。这两种账户都可以创建公开的代码仓库,但是付费账户还可以创建私有的代码仓库。根据在2009年的Git用户调查,GitHub是最流行的Git访问站点.
除了允许个人和组织创建和访问保管中的代码以外,它也提供了一些方便社会化共同软件开发的功能,即一般人口中的社区功能,包括允许用户追踪其他用户、组织、软件库的动态,对软件代码的改动和bug提出评论等。GitHub也提供了图表功能,用于概观显示开发者们怎样在代码库上工作以及软件的开发活跃程度。
截止到2015年,GitHub已经有超过九百万注册用户和2110万代码库。
事实上已经成为了世界上最大的代码存放网站和开源社区
更多:维基百科


开始使用GitHub

本文是我对于官方文档:Hello World 的翻译。

Hello World 项目是计算机编程中一个历史悠久的传统。 这是一个在你开始学习新东西时候的简单练习。 让我们开始使用GitHub吧!
您将学会:

  • 创建和使用存储库(repository);
  • 启动和管理新分支(branch);
  • 对文件进行更改并将其推送提交(commit)到GitHub ;
  • 打开并合并一个Pull请求。

什么是GitHub?

GitHub是用于版本控制和协作的代码托管平台。 它可以让你和其他人在任何地方协同工作同一个项目。
本教程教你GitHub的要素,如仓库(repositories)分支(branches)提交(commits)Pull请求。 您将创建自己的Hello World 项目存储库,并学习GitHub的Pull Request工作流程,这是一种流行的创建和审查代码的方法。

无需编码

要完成本教程,您需要一个GitHub帐户和可以连接的Internet网络。 您不需要知道如何编码,使用命令行,或安装Git(GitHub的版本控制软件被建立于此)。

提示:在单独的浏览器窗口(或选项卡)中打开此指南,以便在完成教程中的步骤时可以看到它。


步骤1.创建存储库(Repository)

存储库(repository)通常用于组织单个项目。 存储库可以包含文件夹和文件,图像,视频,电子表格和数据集 - 即项目需要的任何内容。 我们建议您包括一个README文件,或包含有关您的项目信息的文件。 GitHub使得在创建新存储库的同时添加一个README文件很容易实现。 它还提供其他常见选项,如许可证文件。
你的 hello-world 存储库 可以是一个你存储想法,资源,甚至与他人分享和讨论内容的地方。

创建新存储库(Repository)

  1. 在右上角,在您的头像或识别码旁边,单击 + 然后选择“Create new...”。
  2. 命名您的存储库名称为hello-world
  3. 写一个简短的描述(description)。
  4. 勾选 Initialize this repository with a README(使用README初始化此存储库。)

    点击 Create repository(创建存储库)。

步骤2.创建分支(Branch)

分支(Branching) 是同时在同一个存储库中创建不同版本的方式。
默认情况下,你的仓库有一个名称为master的分支,它被认为是最终分支。 我们使用分支进行实验和编辑,然后将分支提交到master
当您在主master分支上创建分支时,您就创建了主master节点在该时间点的副本或快照。 如果有人在您在分支上工作时对主master分支进行了更改,你就可以提取这些更新。
此图显示:

  • 主分支 The master branch
  • 一个新的分支称之为 映像(feature)(因为我们在这个分支上做“映像工作”)
  • 在映像(feature)被合并到主 master分支上的旅程

你曾经保存过一个文件的不同版本吗? 就像是:

  • story.txt
  • story-joe-edit.txt
  • story-joe-edit-reviewed.txt

分支(Branch) 在GitHub存储库中实现类似的目标。
在GitHub上,我们的开发人员,作家和设计师使用分支来保持错误的修复和功能工作在独立于我们的主(产品)分支上。 当更改准备就绪时,它们将其分支合并到主master()节点上。

创建一个新的分支

  1. 进入您的新存储库hello-world
  2. 单击文件列表顶部叫做 branch:master 的下拉列表。
  3. 在新分支文本框中键入分支名称readme-edits
  4. 选择蓝色的 Create branch 框或按键盘上的“Enter”。

    现在你有两个分支,masterreadme-edits。 他们看起来完全一样,但不长久! 接下来,我们将把更改添加到新分支。

步骤3.制作并提交更改

哇哦! 现在,你在readme-edits分支的代码视图上,这是master的副本。 让我们做一些编辑。
在GitHub上,保存的更改称为提交(commit)。 每个提交都有一个相关的提交消息,这是一个描述为什么进行特定更改的描述。 提交消息会捕获您更改的历史记录,因此其他参与者可以了解您的操作以及原因。

制作并提交更改

  1. 单击README.md文件。
  2. 在文件视图的右上角单击✎铅笔图标编辑。
  3. 在编辑器中,写一点关于你自己的东西。
  4. 编写提交消息来描述您的更改的内容。
  5. 单击 Commit changes 提交更改按钮。

    这些更改将只发生在readme-edits分支上的README文件,因此现在此分支包含的内容与master不同。

步骤4.开启拉取请求(Pull Request)

干得漂亮! 现在,您在master的分支中有更改,您可以开启拉取请求了。
Pull Request 请求是GitHub协作的核心。 当您开启拉取请求时,您就会提出您的更改和请求,并要求某人审核并提交您的贡献,并将其合并到他们的分支中。 拉取请求会显示来自两个分支的内容的差异或差异。 更改,添加和减少以绿色和红色显示。
一旦提交(commit)以后,您就可以开启一个拉取请求(Pull Request)并,在代码完成之前展开讨论。
通过在您的请求消息中使用GitHub的@提醒系统,您可以请求特定人员或团队的反馈,无论他们是在大厅还是在10个时区以外。
您甚至可以在您自己的存储库中开启拉取请求并自行合并它们。 这是一个在更大的项目之前学习GitHub流的伟大的方式。

开启一个对README的更改的Pull Requset

点击图片获得更大的版本

步骤 截图
单击 Pull Requset 选项卡,然后在拉请求页面,单击绿色的 New pull request 按钮。
选择您所做的分支readme-edits,以与master(原始)进行比较。
查看比较页面上的差异更改,确保它们是您要提交的内容。
当您确定这些是您要提交的更改时,单击大的绿色“Create Pull Request”按钮。
给你的Pull Request写一个标题,并写一个简短的描述你的更改。

当你完成填写以上信息后,点击 Create pull request

提示:您可以使用表情符号并将图片和GIF拖放到你的评论和拉取请求上。


步骤5.合并(merge)您的请求

在这最后一步,是时候把你的更改放在一起了 - 合并你的readme-edits分支到master分支。

  1. 单击绿色Merge pull request按钮将更改合并到master中。
  2. 单击确认合并(Confirm merge)。
  3. 继续并删除分支,因为它的更改已被合并,删除分支(Delete branch)按钮在紫色框中。


恭喜

通过完成本教程,您已经学会了创建一个项目,并在GitHub上发出pull request了

翻译出处:https://guides.github.com/activities/hello-world/

GitHub使用入门讲解--官方文档翻译让你最真实了解相关推荐

  1. Ionic Framework 5官方文档翻译

    Ionic Framework 5官方文档翻译 入门 Ionic Framework 5特点 Ionic Framework是什么? 核心概念 构建你的第一个应用 先进的Web应用 浏览器支持 版本控 ...

  2. 【Netty】入门Netty官方例子解析(二)Time Server

    本文承接上文<[Netty]入门Netty官方例子解析(一)写个 Discard Server> ,接下来讲解官网文档中Netty入门官方例子第二个例子 Time Server 原文这个章 ...

  3. 欢迎参与 KubeVela 官方文档翻译活动

    来源 | 阿里巴巴云原生公众号 背景 KubeVela v1.0 启用了新的官网架构和文档维护方式,新增功能包括文档版本化控制.i18n 国际化以及自动化流程.但目前 KubeVela 官方文档只有英 ...

  4. 【KubeVela 官方文档翻译】,欢迎大家踊跃参与

    简介:KubeVela v1.0 启用了新的官网架构和文档维护方式,新增功能包括文档版本化控制.i18n 国际化以及自动化流程.但目前 KubeVela 官方文档只有英文版,这提高了学习和使用 Kub ...

  5. GitHub Actions入门教程:自动化部署静态博客

    前天,我使用 GitHub Actions 实现了静态博客的自动化部署,觉得它非常强大,只要你提交到 GitHub,后面的部署完全由 GitHub 自动完成. 这里提的静态博客,就是通过生成工具(eg ...

  6. Jess 7.2p2——Java平台规则引擎官方文档翻译1

    Jess 7.2p2--Java平台规则引擎官方文档翻译1 本博客转载自本体小本营. 1.入门 1.1.需求 在使用Jess前请先确认JVM是否正确安装并能正常工作. 使用JessDE集成开发环境,你 ...

  7. iOS 官方文档翻译

    各路大神爱发博客的.爱写写东西的.爱分享的.爱技术的.潮人.妹纸.男神.都可已加入到我们这个大家庭来.一起做些有趣的事情.iOS 官方文档翻译QQ群:486111671.github 地址:https ...

  8. Prism 8 官方文档翻译 -- 下载安装Prism v8

    Prism 8 官方文档翻译 – 下载安装Prism v8 第一步:安装系统依赖项 Prism设计为在Microsoft Windows 8桌面,Microsoft Windows 7,Windows ...

  9. GitHub Actions入门教程

    GitHub Actions入门教程 GitHub Marketplace · Actions to improve your workflow · GitHub 概述 GitHub Actions ...

最新文章

  1. QEMU支持的网络模式
  2. js操作完的数值赋回html元素,JS的学习
  3. hive mysql windows_Java-从MySQL到Hive导入,其中MySQL在Windows上运行,而Hive在Cent OS上运行(Horton Sandbox)...
  4. 合数分解质数c语言算法,合数分解成质数之和问题探究
  5. 图解集合6:LinkedHashMap
  6. Java关键字fymd,JAVA程式碼一直被foritfy檢出有path manipulation
  7. 数据分析师如何正确地提意见?
  8. Win11官方正式版(免激活)
  9. android友盟埋点,友盟埋点详解
  10. Windows10 V2004 正式版发布
  11. 《编程珠玑,字字珠玑》45678读书笔记——编程技巧
  12. 大数据优化服务 黑科技创造价值 智慧旅游来势猛
  13. 记2013移动开发者大会之行
  14. 景安mysql主机_景安国内虚拟主机空间如何创建数据库
  15. thinkphp5中Validate验证模板的使用和二次封装构建项目的验证层
  16. 盛大锦书注册到云梯的 C# 程序
  17. word标题和目录制作方法
  18. GetData软件使用--获取曲线图中的数据
  19. mysql数据库ppt_MySQL数据库教学幻灯片讲义.ppt
  20. Java 中如何解决 POI 读写 excel 几万行数据时内存溢出的问题?(附源码)

热门文章

  1. python反距离权重法_反距离权重法 (Spatial Analyst)—ArcMap | 文档
  2. jetbrains(IDEA/Pycharm)修改断点的颜色与调试时debugger的颜色
  3. 解决python报错写入文件 io.UnsupportedOperation: not writable
  4. 解决Numpy 报错 ValueError: zero-size array to reduction operation maximum which has no identity
  5. 250php货币,FreeHostia免费PHP空间中文面板250MB空间6GB流量
  6. python网页调用摄像头_Python调用摄像头
  7. 关于php的函数,总结关于PHP文件函数有哪些
  8. Java中反射主要应用在哪里_Java学习:反射的应用场景和解析方法
  9. jquery 取值 数值_jQuery – 使用正则表达式获取数据值
  10. 20145236 《Java程序设计》 第6周学习总结