GitHub

Wiki百科上是这么说的

GitHub 是一个共享虚拟主机服务,用于存放使用Git版本控制的软件代码和内容项目。它由GitHub公司(曾称Logical Awesome)的开发者Chris Wanstrath、PJ Hyett和Tom Preston-Werner 使用Ruby on Rails编写而成。

当然让我们看看官方的介绍:

GitHub is the best place to share code with friends, co-workers, classmates, and complete strangers. Over eight million people use GitHub to build amazing things together.

它还是什么?

  • 网站
  • 免费博客
  • 管理配置文件
  • 收集资料
  • 简历
  • 管理代码片段
  • 托管编程环境
  • 写作

等等。看上去像是大餐,但是你还需要了解点什么?

版本管理与软件部署

jQuery[^jQuery]在发布版本2.1.3,一共有152个commit。我们可以看到如下的提交信息:

  • Ajax: Always use script injection in globalEval … bbdfbb4
  • Effects: Reintroduce use of requestAnimationFrame … 72119e0
  • Effects: Improve raf logic … 708764f
  • Build: Move test to appropriate module fbdbb6f
  • Build: Update commitplease dev dependency

GitHub与Git

Git是一个分布式的版本控制系统,最初由Linus Torvalds编写,用作Linux内核代码的管理。在推出后,Git在其它项目中也取得了很大成功,尤其是在Ruby社区中。目前,包括Rubinius、Merb和Bitcoin在内的很多知名项目都使用了Git。Git同样可以被诸如Capistrano和Vlad the Deployer这样的部署工具所使用。

GitHub可以托管各种git库,并提供一个web界面,但与其它像 SourceForge或Google Code这样的服务不同,GitHub的独特卖点在于从另外一个项目进行分支的简易性。为一个项目贡献代码非常简单:首先点击项目站点的“fork”的按钮,然后将代码检出并将修改加入到刚才分出的代码库中,最后通过内建的“pull request”机制向项目负责人申请代码合并。已经有人将GitHub称为代码玩家的MySpace。

在GitHub创建项目

接着,我们试试在上面创建一个项目:

GitHub Roam GitHub Roam

就会有下面的提醒:

GitHub Roam GitHub Roam

它提供多种方式的创建方法:

…or create a new repository on the command line

  1. echo "# github-roam" >> README.md
  2. git init
  3. git add README.md
  4. git commit -m "first commit"
  5. git remote add origin git@github.com:phodal/github-roam.git
  6. git push -u origin master

…or push an existing repository from the command line

  1. git remote add origin git@github.com:phodal/github-roam.git
  2. git push -u origin master

如果你完成了上面的步骤之后,那么我想你想知道你需要怎样的项目。