Git Product home page Git Product logo

towerdefence's Introduction

TowerDefence

towerdefence's People

Contributors

chrisyoung96 avatar mfunction96 avatar zhenyanxin avatar

Watchers

 avatar  avatar  avatar

Forkers

chrisyoung96

towerdefence's Issues

GitHub 的 Pull Request 作用

作者:beepony
链接:https://www.zhihu.com/question/21682976/answer/79489643
来源:知乎
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

简介

我尝试用类比的方法来解释一下 pull reqeust。想想我们中学考试,老师改卷的场景吧。你做的试卷就像仓库,你的试卷肯定会有很多错误,就相当于程序里的 bug。老师把你的试卷拿过来,相当于先 fork。在你的卷子上做一些修改批注,相当于 git commit。最后把改好的试卷给你,相当于发 pull request,你拿到试卷重新改正错误,相当于 merge。

当你想更正别人仓库里的错误时,要走一个流程:

  1. 先 fork 别人的仓库,相当于拷贝一份,相信我,不会有人直接让你改修原仓库的
  2. clone 到本地分支,做一些 bug fix
  3. 发起 pull request 给原仓库,让他看到你修改的 bug
  4. 原仓库 review 这个 bug,如果是正确的话,就会 merge 到他自己的项目中

至此,整个 pull request 的过程就结束了。
理解了 pull request 的含义和流程,具体操作也就简单了。以 Github 排名最高的 https://github.com/twbs/bootstrap 为例说明。

1. 先点击 fork 仓库,项目现在就在你的账号下了

image
image

2. 在你自己的机器上 git clone 这个仓库,切换分支(也可以在 master 下),做一些修改。

git clone https://github.com/beepony/bootstrap.git
cd bootstrap
git checkout -b test-pr
git add . && git commit -m "test-pr"
git push origin test-pr

3. 完成修改之后,回到 test-pr 分支,点击旁边绿色的 Compare & pull request 按钮

image

4. 添加一些注释信息,确认提交

image

5. 仓库作者看到,你提的确实是对的,就会 merge,合并到他的项目中

以上就是 pull reqesut 的整个流程~

参考文档

Fork A Repo - User Documentation
Using pull requests
Creating a pull request

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.