前言:这个是官方教程,看完以为写的挺好的,因而翻译一下给须要的人,本人才疏学浅,有翻译的不到位的地方欢迎指正.git
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 getgithub
在计算机编程领域,每当学习一个新的东西的时候,开始都会建立一个HelloWorld工程,这是一个历史悠久的传统,那么,就让咱们也经过HelloWorld开始咱们的GitHub之旅编程
started with GitHub!并发
吧!编辑器
You’ll learn how to:ide
你将学会如何:学习
What is GitHub?ui
什么是GitHubthis
GitHub is a code hosting platform for version control and collaboration. It lets you and others work together on projects from anywhere.idea
GitHub是一个很是方便进行版本控制和联合开发的代码托寄平台.
This tutorial teaches you GitHub essentials like repositories, branches, commits, and Pull Requests. You’ll create your own Hello World repository and
这个教程将会教你几个关于GitHub的要点,像库,分支,更新和Pull Request.你将会建立你本身的HelloWorld库而且学会GitHubPull Request的工做流程,对建立和回顾代码来讲,
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
为了完成这个教程,你仅仅须要一个GitHub帐户和一台能上网的电脑.你不须要知道如何写控制Git的代码,使用命令行程序或者安装Git(GitHub的版本控制软件)
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.
提醒:你能够把这个教程和GitHub的其余网页以不一样的窗口或标签打开来更方便的查看
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
咱们建议你的项目里面必定要包括一个readme或者说一个包含关于项目信息的文件.GitHub会在你建立一个新的库的时候提供建立这个readme文件的选项,这很是方
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.
你的HelloWorld库是一个能够存放想法 资源甚至是一个和其余人分享和讨论事情的地方.
To create a new repository
建立一个新的库
Click Create repository.
点击Create repository按钮.
第二步.建立一个分支
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
.
默认状况下你新建的库里面会有一个叫作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
当你建立一个不一样于master的新的分支时,就至关于把你的master分支项目复制了一份,当有人更改这个项目时,你能够选择把这些更改做为更新加入到你的master分支项目里.
were working on your branch, you could pull in those updates.
This diagram shows:
下面的这个图展现的是:
master
branchfeature
(because we’re doing ‘feature work’ on this branch)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
在GitHub,咱们开发者,做家和设计师经过使用来自master的不一样分支来修补bug和完成各自不一样的工做. 当更新完成后,他们把这些不一样的分支合并到master分支里.
their branch into master
.
建立一个新的分支
hello-world
.1.去HelloWorld所在的库.readme-edits
, into the new branch text box.3.在输入框中输入一个新的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.
如今你有了两个分支,master和readme-edits.他们几乎同样,可是不会好久.接下来咱们就要在新的分支里加入改动.
第三步.提交一次更改
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 associatedcommit message, which is a description explaining why a particular change was made. Commit messages capture
在GitHub上,保存改动被称为commits.每一个commit都会有一个关联的commit信息,commit信息用来记录每次更改的内容,经过这个信息其余人可以明白你作了什么,为何作.
the history of your changes, so other contributors can understand what you’ve done and why.
提交一次更改
README.md
file.1. 点击 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的分支里作出了改动,所以如今这个分支里已经包含着与master分支不一样的内容了.
第四步.发起一个Pull Request
Nice edits! Now that you have changes in a branch off of master
, you can open a pull request.
改的好,如今你已经对作了不一样于master的改动,你能够发起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
在GitHub上,Pull Requests是协同合做的核心,当你发起一次Pull request时,你是在提出你的改动,是在请求别人检查你的工做成果并把这些成果合并到他的分支中.
merge them into their branch. Pull requests showdiffs, or differences, of the content from both branches. The changes, additions, and subtractions are shown in green and red.
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,甚至在你完成代码以前.
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.
经过在你的pull request信息中使用GitHub的@mention 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 reque并合并到你的项目里.在开始一个大项目以前,了解GitHub的这个工做流程真的很是重要.
对README发起一个pull request
Click on the image for a larger version
点击图片放大
Click the Pull Request tab, then from the Pull Request page, click the green New pull request button.
点击Pull Request 标签,而后在pull request页中点击 绿色的New pull request 按钮.
Select the branch you made,readme-edits
, to compare with master
(the original).
选择你更改过的readme-edits分支来和master分支进行比较.
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 Requestbutton.
当你对这些所作的更改满意并想要提交的话,点击那个大大的Create Pull Request按钮.
Give your pull request a title and write a brief description of your changes.
给你的pull request起一个名字并写一个简单的描述
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.
提示:在pull request信息中,你能够用表情符号或拖拽图片进去.
第五步.合并你的Pull Request
In this final step, it’s time to bring your changes together – merging yourreadme-edits
branch into the master
branch.
最后一步了,如今是时候把你的改动合并了,把你的readme-edits分支合并到master分支里.
master. 1
.点击绿色的Merge pull request 按钮来把改动合并到master里.3.如今你能够把这个分支删掉了,由于它的改动已经被合并到master里面了,删除按钮是 Delete branch,在一个紫色的框里.
庆祝吧!
By completing this tutorial, you’ve learned to create a project and make a pull request on GitHub!
经过完成这个教程,你已经学会如何在GitHub上建立一个项目并发起一个pull request!
Here’s what you accomplished in this tutorial:
下面是你经过这个教程学会的技能
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 request的内容,咱们推荐阅读 GitHub Flow Guide. 你还能够经过访问GitHub Explore来参与到一个开源项目中去.再见.
Tip: Check out our other Guides and YouTube Channel for more GitHub how-tos.
提示:查看咱们的其余的指导和Youtube频道来学习更多的教程.
结语:排版和翻译不容易,转载请注明出处:http://www.cnblogs.com/qiaogaojian/ 谢谢.