注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

伯纳乌の夢

可以挽回么?我们按“ Ctrl+Z”撤销掉吧。对不起啦~~

 
 
 

日志

 
 
 
 

[Fw]Fork A Repo  

2011-05-06 22:55:00|  分类: 默认分类 |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |
[Trackback]http://help.github.com/fork-a-repo/

Fork A Repo

If you’ve found yourself on this page, we’re assuming you’re brand new to Git and GitHub. This guide will walk you through the basics and explain a little bit about how everything works along the way.

First: Fork A Repo

At some point you may find yourself wanting to contribute to someone else’s project, or would like to use someone’s project as the starting point for your own. This is known as “forking.” For this tutorial, we’ll be using the Spoon-Knife project.

  1. Fork the “Spoon-Knife ” repo

    To fork this project, click the “Fork” button.

    Click “Fork

Next: Set Up Your Local Repo

You’ve successfully forked the Spoon-Knife repo, but so far it only exists on GitHub. To be able to work on the project, you will need to clone it to your local machine.

  1. Clone the “Spoon-Knife” project

    Run the following code:

    $ git clone git@github.com:username/Spoon-Knife.git 
  2. Configure remotes

    When a repo is cloned, it has a default remote called origin that points to your fork on GitHub, not the original repo it was forked from. To keep track of the original repo, you need to add another remote named upstream:

    More about remotes

    $ cd Spoon-Knife $ git remote add upstream git://github.com/octocat/Spoon-Knife.git $ git fetch upstream 

Then: More Things You Can Do

You’ve successfully forked a repo, but get a load of these other cool things you can do:

  • Push commits

    Once you’ve made some commits to a forked repo and want to push it to your forked project, you do it the same way you would with a regular repo:

    More about commits

    $ git push origin master 
  • Pull in upstream changes

    If the original repo you forked your project from gets updated, you can add those updates to your fork by running the following code:

    $ git fetch upstream $ git merge upstream/master 

    What is the difference between fetch and pull?

  • Work with branches

    Branching allows you to build new features or test out ideas without putting your main project at risk. A Git branch is a small file that references the commit it was spawned from. This makes Git branches very small and easy to work with.

    How do I use branches?

  • Pull requests

    If you are hoping to contribute back to the original fork, you can send the original author a pull request.

Lastly: Celebrate

You have now created forked a repo. What do you want to do next?

  1. Set Up Git
  2. Create A Repository
  3. Fork A Repository
  4. Be Social
  评论这张
 
阅读(455)| 评论(0)
推荐 转载

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017