Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
github
hub
提交
28b64ba9
H
hub
项目概览
github
/
hub
大约 1 年 前同步成功
通知
3
Star
22523
Fork
2406
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hub
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
28b64ba9
编写于
3月 20, 2012
作者:
M
Mislav Marohnić
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
reword and reorganize Readme
上级
ebee2c20
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
94 addition
and
92 deletion
+94
-92
README.md
README.md
+94
-92
未找到文件。
README.md
浏览文件 @
28b64ba9
hub:
git + hub = github
git + hub = github
==================
=====
==================
`hub`
is a command line utility which adds GitHub knowledge to
`git`
.
hub is a command line tool that wraps
`git`
in order to extend it with extra
features and commands that make working with GitHub easier.
It can be used on its own or as a
`git`
wrapper.
~~~
sh
$
hub clone rtomayko/tilt
Normal:
# expands to:
$
git clone git://github.com/rtomayko/tilt.git
~~~
$ hub clone rtomayko/tilt
hub is best aliased as
`git`
, so you can type
`$ git <command>`
in the shell and
get all the usual
`hub`
features. See "Aliasing" below.
Expands to:
$ git clone git://github.com/rtomayko/tilt.git
Wrapping
`git`
:
Installation
------------
$ git clone rack/rack
Dependencies:
Expands to:
*
**git 1.7.3**
or newer
$ git clone git://github.com/rack/rack.git
*
**Ruby 1.8.6**
or newer
hub requires you have
`git`
installed and in your
`$PATH`
. It also
### Homebrew
requires Ruby 1.8.6+ or Ruby 1.9.1+. No other libraries necessary.
Installing on OS X is easiest with Homebrew:
Install
~~~
sh
-------
$
brew
install
hub
~~~
### Standalone
### Standalone
`hub`
is
most
easily installed as a standalone script:
`hub`
is easily installed as a standalone script:
curl http://defunkt.io/hub/standalone -sLo ~/bin/hub &&
~~~
sh
chmod 755 ~/bin/hub
$
curl http://defunkt.io/hub/standalone
-sLo
~/bin/hub
&&
chmod
+x ~/bin/hub
~~~
Assuming
`~/bin/`
is in your
`$PATH`
, you're ready to roll:
Assuming
"~/bin/"
is in your
`$PATH`
, you're ready to roll:
$ hub version
~~~
sh
git version 1.7.0.4
$
hub version
hub version 1.1.0
git version 1.7.6
hub version 1.8.3
### Homebrew
~~~
$ brew install hub
$ which hub
/usr/local/bin/hub
$ hub version
...
### RubyGems
### RubyGems
Though not recommended,
`hub`
can also be installed as a RubyGem:
Though not recommended,
hub
can also be installed as a RubyGem:
$ gem install hub
~~~
sh
$
gem
install
hub
~~~
(It's not recommended for casual use because of the RubyGems startup
(It's not recommended for casual use because of the RubyGems startup
time. See
[
this gist
][
speed
]
for information.)
time. See
[
this gist
][
speed
]
for information.)
### Standalone via RubyGems
###
#
Standalone via RubyGems
$ gem install hub
~~~
sh
$ hub hub standalone > ~/bin/hub && chmod 755 ~/bin/hub
$
gem
install
hub
$
hub hub standalone
>
~/bin/hub
&&
chmod
+x ~/bin/hub
~~~
This installs a standalone version which doesn't require RubyGems to
This installs a standalone version which doesn't require RubyGems to
run.
run
, so it's faster
.
### Source
### Source
You can also install from source:
You can also install from source:
$ git clone git://github.com/defunkt/hub.git
~~~
sh
$ cd hub
$
git clone git://github.com/defunkt/hub.git
$ rake install prefix=/usr/local
$
cd
hub
&&
rake
install
prefix
=
/usr/local
~~~
### Help! It's Slow!
### Help! It's Slow!
...
@@ -79,11 +85,11 @@ Is your prompt slow? It may be hub.
...
@@ -79,11 +85,11 @@ Is your prompt slow? It may be hub.
1.
Check that it's
**not**
installed using RubyGems.
1.
Check that it's
**not**
installed using RubyGems.
2.
Check that RUBYOPT isn't loading anything shady:
2.
Check that RUBYOPT isn't loading anything shady:
$ echo $RUBYOPT
$ echo $RUBYOPT
3.
Check that your system Ruby is speedy:
3.
Check that your system Ruby is speedy:
$ time /usr/bin/env ruby -e0
$ time /usr/bin/env ruby -e0
If #3 is slow, it may be your
[
GC settings
][
gc
]
.
If #3 is slow, it may be your
[
GC settings
][
gc
]
.
...
@@ -91,30 +97,32 @@ If #3 is slow, it may be your [GC settings][gc].
...
@@ -91,30 +97,32 @@ If #3 is slow, it may be your [GC settings][gc].
Aliasing
Aliasing
--------
--------
`hub`
works best when it wraps
`git`
. This is not dangerous - your
Using hub feels best when it's aliased as
`git`
. This is not dangerous; your
normal git commands should all work. hub merely adds some sugar.
_normal git commands will all work_
. hub merely adds some sugar.
Typing
`hub alias <shell>`
will display alias instructions for
your shell.
`hub alias`
alone will show the known shells.
For example:
`hub alias <shell>`
displays alias instructions for the given shell.
`hub alias`
alone will show the known shells.
$ hub alias bash
~~~
Run this in your shell to start using `hub` as `git`:
$ hub alias bash
alias git=hub
Run this in your shell to start using `hub` as `git`:
alias git=hub
~~~
You should place this command in your
`.bash_profile`
or other startup
You should place this command in your
`.bash_profile`
or other startup
script to ensure runs on login.
script to ensure runs on login.
The alias command can also be eval'd directly using the
`-s`
flag:
The alias command can also be eval'd directly using the
`-s`
flag:
$ eval `hub alias -s bash`
~~~
sh
$
eval
`
hub
alias
-s
bash
`
~~~
Commands
Commands
--------
--------
Assuming you've aliased
`hub`
to
`git`
, the following commands now have
Assuming you've aliased
hub as
`git`
, the following commands now have
superpowers:
superpowers:
### git clone
### git clone
...
@@ -292,10 +300,12 @@ superpowers:
...
@@ -292,10 +300,12 @@ superpowers:
> (hub man page)
> (hub man page)
GitHub Login
Configuration
------------
-------------
### GitHub username & token
To get the most out of
`hub`
, you'll want to ensure your GitHub login
To get the most out of
hub
, you'll want to ensure your GitHub login
is stored locally in your Git config or environment variables.
is stored locally in your Git config or environment variables.
To test it run this:
To test it run this:
...
@@ -312,59 +322,47 @@ setup "github.token" as well. See [GitHub config guide][2] for more information.
...
@@ -312,59 +322,47 @@ setup "github.token" as well. See [GitHub config guide][2] for more information.
If present, environment variables
`GITHUB_USER`
and
`GITHUB_TOKEN`
override the
If present, environment variables
`GITHUB_USER`
and
`GITHUB_TOKEN`
override the
values of "github.user" and "github.token".
values of "github.user" and "github.token".
Configuration
### HTTPS insted of git protocol
-------------
If you prefer using the HTTPS protocol for GitHub repositories instead of the git
If you prefer using the HTTPS protocol for GitHub repositories instead of the git
protocol for read and ssh for write, you can set "hub.protocol" to "https".
protocol for read and ssh for write, you can set "hub.protocol" to "https".
For example:
~~~
sh
# default behavior
$ git clone defunkt/repl
$
git clone defunkt/repl
< git clone >
< git clone
>
$ git config --global hub.protocol https
$ git clone defunkt/repl
< https clone >
Prior Art
# opt into HTTPS:
---------
$
git config
--global
hub.protocol https
$
git clone defunkt/repl
These projects also aim to either improve git or make interacting with
< https clone
>
GitHub simpler:
~~~
*
[
eg
](
http://www.gnome.org/~newren/eg/
)
*
[
github-gem
](
https://github.com/defunkt/github-gem
)
Contributing
Contributing
------------
------------
These instructions assume that you already have
`hub`
installed and that
These instructions assume that you already have
hub installed and aliased as
you've set it up so it wraps
`git`
(see "Aliasing").
`git`
(see "Aliasing").
1.
Clone hub:
1.
Clone hub:
`git clone defunkt/hub`
`git clone defunkt/hub && cd hub`
2.
Verify that existing tests pass (see "Development dependencies"):
1.
Install development dependencies:
`rake test`
`bundle install`
2.
Verify that existing tests pass:
`bundle exec rake`
3.
Create a topic branch:
3.
Create a topic branch:
`git checkout -b
my_branch
`
`git checkout -b
feature
`
4.
Make your changes – it helps a lot if you write tests first
4.
**Make your changes.**
(It helps a lot if you write tests first.)
5.
Verify that tests still pass:
5.
Verify that tests still pass:
`
rake test
`
`
bundle exec rake
`
6.
Fork hub on GitHub (adds a remote named "YOUR_USER"):
6.
Fork hub on GitHub (adds a remote named "YOUR_USER"):
`git fork`
`git fork`
7.
Push to your fork:
7.
Push to your fork:
`git push -u YOUR_USER
my_branch
`
`git push -u YOUR_USER
feature
`
8.
Open a pull request describing your changes:
8.
Open a pull request describing your changes:
`git pull-request`
`git pull-request`
### Development dependencies
You will need the following libraries for development:
*
[
ronn
](
https://github.com/rtomayko/ronn
)
(
building
man pages)
*
[
webmock
](
https://github.com/bblimke/webmock
)
Meta
Meta
----
----
...
@@ -372,12 +370,16 @@ Meta
...
@@ -372,12 +370,16 @@ Meta
*
Home:
<https://github.com/defunkt/hub>
*
Home:
<https://github.com/defunkt/hub>
*
Bugs:
<https://github.com/defunkt/hub/issues>
*
Bugs:
<https://github.com/defunkt/hub/issues>
*
Gem:
<https://rubygems.org/gems/hub>
*
Gem:
<https://rubygems.org/gems/hub>
*
Authors:
<https://github.com/defunkt/hub/contributors>
### Prior art
These projects also aim to either improve git or make interacting with
GitHub simpler:
Authors
*
[
eg
](
http://www.gnome.org/~newren/eg/
)
-------
*
[
github-gem
](
https://github.com/defunkt/github-gem
)
<https://github.com/defunkt/hub/contributors>
[
speed
]:
http://gist.github.com/284823
[
speed
]:
http://gist.github.com/284823
[
2
]:
http://help.github.com/set-your-user-name-email-and-github-token/
[
2
]:
http://help.github.com/set-your-user-name-email-and-github-token/
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录