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。

相關文章
相關標籤/搜索