前言:這個是官方教程,看完以爲寫的挺好的,因而翻譯一下給須要的人,本人才疏學淺,有翻譯的不到位的地方歡迎指正.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/ 謝謝.