• GitHub入门教程 Hello World for GitHub


         

    1. Intro                              1.简介
    2. What is GitHub?           2.什么是github?
    3. Create a Repository     3.创建一个库
    4. Create a Branch            4.创建一个分支
    5. Make a Commit            5.做一次提交
    6. Open a Pull Request     6.提出一次Pull Request
    7. Merge Pull Request      7.合并Pull Request

     

    前言:这个是官方教程,看完觉得写的挺好的,于是翻译一下给需要的人,本人才疏学浅,有翻译的不到位的地方欢迎指正.

    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

    在计算机编程领域,每当学习一个新的东西的时候,开始都会创建一个HelloWorld工程,这是一个历史悠久的传统,那么,就让我们也通过HelloWorld开始我们的GitHub之旅

    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
    • 修改一个文件并把这项修改上传到GitHub
    • Open and merge a pull request
    • 打开并合并一次Pull Request

     

    What is GitHub?

    什么是GitHub

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

    GitHub是一个非常方便进行版本控制和联合开发的代码托寄平台.

    This tutorial teaches you GitHub essentials like repositoriesbranchescommits, 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

    第一步.创建一个库

    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

    创建一个新的库

    1. In the upper right corner, next to your avatar or identicon, click  and then select New repository.1.在右上角,点击加号选择New repository.
    2. Name your repository hello-world.2.给库命名hello-world
    3. Write a short description.3.写一下这个库的简要说明
    4. Select Initialize this repository with a README.4.选择生成一个带README的库

     

    Click Create repository

    点击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.

    默认情况下你新建的库里面会有一个叫做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:

    下面的这个图展示的是:

    • The master branch
    • master分支
    • A new branch called feature (because we’re doing ‘feature work’ on this branch)
    • 一个叫做feature的新的分支(因为在这个分支上做的是不一样的工作)
    • The journey that feature takes before it’s merged into master
    • 这就是feature分支被合并到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.

    To create a new branch

    创建一个新的分支

    1. Go to your new repository hello-world.1.去HelloWorld所在的库.
    2. Click the drop down at the top of the file list that says branch: master.2.点击branch按钮中的下拉菜单中的master.
    3. Type a branch name, readme-edits, into the new branch text box.3.在输入框中输入一个新的branch名字: readme-edits,
    4. Select the blue Create branch box or hit “Enter” on your keyboard.4.点击蓝色的Create Branch按钮或者按下Enter键.

    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.他们几乎一样,但是不会很久.接下来我们就要在新的分支里加入改动.

     

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

    Make and commit changes

    提交一次更改

    1. Click the README.md file.1. 点击 README.md文件
    2. Click the  pencil icon in the upper right corner of the file view to edit.2.为了编辑,点击文件右上角的钢笔图标
    3. In the editor, write a bit about yourself.3.在编辑器里,写一些关于你的事.
    4. Write a commit message that describes your changes.4.写一个commit说明来说明你的改动.
    5. Click Commit changes button.5.点击Commit changes按钮.

    These changes will be made to just the README file on your readme-editsbranch, so now this branch contains content that’s different from master.

     这下在你已经在你的readme-edits的分支里做出了改动,因此现在这个分支里已经包含着与master分支不同的内容了.

     

    Step 4. Open a Pull Request

    第四步.发起一个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的这个工作流程真的非常重要.

     

    Open a Pull Request for changes to the README

    对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信息中,你可以用表情符号或拖拽图片进去.

     

    Step 5. Merge your 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分支里.

    1. Click the green Merge pull request button to merge the changes intomaster. 1.点击绿色的Merge pull request 按钮来把改动合并到master里.
    2. Click Confirm merge.2.点击Confirm merge按钮.
    3. Go ahead and delete the branch, since its changes have been incorporated, with the Delete branch button in the purple box.

         3.现在你可以把这个分支删掉了,因为它的改动已经被合并到master里面了,删除按钮是 Delete branch,在一个紫色的框里.

    Celebrate!

    庆祝吧!

    By completing this tutorial, you’ve learned to create a project and make a pull request on GitHub! :tada: :octocat: :zap:

    通过完成这个教程,你已经学会如何在GitHub上创建一个项目并发起一个pull request!

    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
    • 改动一个文件并把这些改动更新到GitHub上.
    • Opened and merged a Pull Request.
    • 发起并合并一个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 :octocat:

     如果你想学习更多关于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/  谢谢.

  • 相关阅读:
    设置Edittext全键盘
    Math中和角度,弧长,tan等相关的算法
    Android:TabLayout的一些设置
    Android;设置TextView加粗 代码设置
    Android:关于Edittext的一些设置
    Android:View颤抖的动画效果代码
    Android:dialog去除边框的实现(自带Style的padding)
    Android:自定义Dialog大小,显示圆角
    Android:EventBus
    SAS宏系统选项SYMBOLGEN MCOMPILENOTE MPRINT<NEST> MLOGIC(NEST)
  • 原文地址:https://www.cnblogs.com/qiaogaojian/p/6131845.html
Copyright © 2020-2023  润新知