GitHub 翻译之 'Hello-world' 翻译

https://guides.github.com/activities/hello-world/ 页面翻译

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! 
‘Hello World’在计算机编程界是一个历史悠久的传统项目。当你学习一个新的编程知识的时候,它是带你入门的一个很好的练习。咱们一块儿开始学习 GitHub!git

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 
  
在这里你会学到: 
- 如何建立和使用一个代码版本库 
- 如何启动和管理一个新的代码分支 
- 如何修改一个文件并把它们提交到GitHub 上 
- 如何打开一个代码合并请求github

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. 
 GitHub 是一个代码版本控制和协做的平台。它可以使你和他人不管在什么地方都可以一块儿去开发一个项目。shell

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. 
  这个辅助教程教你一些例如代码库、分支、托管、处理请求等。你将会建立你本身的’Hello World’ 代码库,而且学习GitHub’s 处理请求的工做流,它是一个很是流行的建立和查看代码的工具。编程

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). 
  要完成本教程,你只须要两个条件,一个是可以上网,另外一个是须要注册一个GitHub.com 的帐号。你不须要知道如何编程、使用命令行、或者安装Git(GitHub是创建在这个版本控制软件之上)。ide

Tip: Open this guide in a separate browser window (or tab) so you can see it while you complete the steps in the tutorial. 
注意:把这个教程在一个单独的窗口(或者tab)中打开,这样当你按照步骤完成项目的时候你就能够看到你建立代码库了。工具

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. 
  一个代码库只能用于组织管理一个项目。代码库能够包含文件夹和文件、图片、视频、电子表格、数据集——你项目须要的任何东西。在你建立新的代码库的时候你就能够把这些东西添加进去,GitHub 是这一切变得特别容易。 它也提供了其余公共的选项,好比说项目协议文件。学习

Your hello-world repository can be a place where you store ideas, resources, or even share and discuss things with others. 
  你的 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.测试

a. 在你主页界面的右上角,点击‘+’ ,选择‘New repository‘。 
b. 把你的代码库命名为hello-world 
c. 写一个简单的描述。 
d. 选择”Initialize this repository with a README” (代码库初始化说明) 
create-new-repo
Click Create repository. 
点击 ” Create repository” 建立代码库动画

Step 2. Create a Branch(步骤2.建立一个分支)

Branching is the way to work on different versions of a repository at one time. 
 分支是同一个代码库在同一时间操做不一样版本的工做方式。ui

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
  你的版本库会默认有一个最终版本,这个最终版本名称叫作 master.在提交给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 的一个时点 进行的一个复制或快照。若是当你在修改你的分支的时候,别人也在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 
  
master 分支 
- 名叫 feature 的分支(由于咱们正在在这个主分支上作‘重要的功能工做’) 
- feature 分支在最终被合并到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.

GitHub 托管代码库要实现的目标就相似这些。 
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
  在GitHub 上,咱们的开发工程师、编辑、设计师在主分支(生产系统)之外使用分支来修复漏洞或新功能开发。当一个漏洞或者新功能测试没有问题后就会把分支合并到主分支中。 
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 hit “Enter” on your keybord.

a. 找到你刚促建立好的 ‘hello-world’项目. 
b. 点击右边中间 ‘Branch: master’ 下拉菜单 
c. 在分支输入框中输入 ‘readme-edits’ 
d. 填写完成后选择Create branch,而后回车 
以下所示: 
readme-edits

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. 
 如今你有两个分支,主分支和新添加的readme-edits分支,它们如今看起来彻底同样,分支readme-edits修改后就不同了。接下来咱们会修改分支readme-edits。

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. 
 好极了!如今,你是在你建立的readme-edits分支的代码页面上,它是master的一个分支,让咱们作一些修改。 
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. 
  在GitHub上,保存修改叫作提交。每一个提交都会有一个关联的提交信息(由提交者和版本控制系统共同完成),这个关联的提交信息用于解释这一块代码为何要修改。这个关联的提交信息可以捕捉到当前版本和历史版本之间的变化,这样其它的代码贡献者才可以知道和理解你修改了什么以及为何要这样修改。 
Make and commit changes 
修改分支代码库并提交 
1. Click the READEME.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. 
  
a. 点击 README.md 文件。 
b. 点击 ‘README.md’ 文件右上面的铅笔图标进行编辑 
c. 在编辑界面,写一些关于你本身的一些信息和这个项目的一些信息。 
d.写一些你修改的地方以及为何修改。 
e.点击提交修改按钮。 
以下图所示: 
commit
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 分支有所不一样了。

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. 
   修改的很好! 如今你已经在master 的一个分支上作好了修改,你能够针对你的修改向项目内的全部人发起修改提交合并请求。 
(就是向项目建立者,还有其余贡献者发起一个请求,但愿你的修改可以合并添加到项目中去,即master 中)

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. 
   Pull Requests 是 GitHub 上各个贡献者协做的核心。当你打开一个Pull Request的时候,你是但愿别人可以针对你的修改做出回复,同步你修改或新增的代码,最好可以把这些代码合并到他们的分支中。Pull requests 可以展现不一样分支代码之间的区别。修改和新增的代码用绿色标出,删除的代码用红色标出。

As soon as you make a commit,you can open a pull request and start a discussion, even before the code is finished. 
   一旦你提交了代码,你就至关于打开了一个Pull Request 供你们讨论,直到代码结束(合并到master中,或者最终没有被采纳)。

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. 
  经过使用 GitHub’s 的@metion system 通知栏,你能够向特定的人或团队发出反馈请求,不管他们就在你的大厅下面或者十个街区之外。 
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. 
  你也能够在你本身的代码库中打开Pull Requests 并把一些修改的代码合并到你的代码中。 在开发稍微大的项目以前,这不失为一个了解GitHub 工做流的好方法。 
Open a Pull Request for changes to the README(为修改的README 打开一个Pull Request)

Click on the image for a large version

Step Screenshot
Click the Pull Request tab,then from the Pull Requests page,click the green New pull request (点击 Pull Request 菜单,进入Pull Request 页面,单击New pull request 按钮) pr-tab
Select the branch you made,readme-edits, to compare with master(the original). (选择你修改的分支,并与原始的master 项目进行比较) pick-branch
Look over your changes in the diffs on the Compare page,make sure they’re what you want to submit.(在比较界面仔细检查你修改的地方与master 的不一样之处,确保那些修改的地方就是你想提交的) diff
When you’re satisfied that these are the changes you want to submit,click the big green Create Pull Request button.(当你对你想提交的代码感受很满意的时候,单击那个绿色的Create Pull Request 大按钮) create-pr
Give your pull request a title and write a brief description of your changes.(给你的 ‘pull request’ 一个标题和简短描述,用于说明你修改的内容 ) pr-form

When you’re done with your message,click Create pull request! 
当这一切填好之后,单击 
Create pull request ! 
Tip: You can use emoji and drag and drop images and gifs onto comments 
and Pull Requests. 
小贴士:你能够把emoji 表情,也能够把图片或者gifs 动画图片拖放到评论的地方和Pull Requests上面.

Step 5. Merge your Pull Request

步骤5 合并你的Pull Request

In this final step, it’s time to bring your changes together -merging your readme-edits branch into the master branch. 
最后,要把你修改的代码即 readme-edits 分支和 master 进行合并。 
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. 
a.点击 绿色的Merge pull request 按钮把你修改的代码合并到主分支master 之中 
b. 点击 确认合并 按钮 
c. 去前一页删除分支,若是你修改的代码已经合并到主分支中,Delete branch (删除分支)按钮会在紫色框中显示。 
以下图所示: 
merge-button
delete-button

Celebrate!

By completing this tutorial,you’ve learned to create a project and make a pull request on GitHub! 
看完这个教程后,你就学会如何在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

如下是你在这个教程中完成的: 
- 建立一个开源的资源库 
- 开始管理一个新的版本分支 
- 修改一些代码文件并把它们提交到GitHub 上 
- 打开和合并一个Pull Request

Take a look at your GitHub profile and you’ll see your new contribution squares! 
浏览一下你的GitHub 文件,你会看到你的巨大贡献。 
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. 
若是你想学习更多关于 Pull Requests 的伟大力量,咱们建议你阅读一下GitHub 的工做流程指导。你也能够探索一下 GitHub 的开源项目列表,并参与到其中一个开源项目中。

Tip: Check out our other Guides and YouTube Channel for more GitHub how-tos. 
小贴士:去咱们另外一个关于GitHub 的指南 和 YouTube 频道 ,进一步了解GitHub。

相关文章
相关标签/搜索