README.md 2.4 KB
Newer Older
M
Mislav Marohnić 已提交
1 2
git + hub = github
==================
C
readme  
Chris Wanstrath 已提交
3

M
Mislav Marohnić 已提交
4 5
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.
C
readme  
Chris Wanstrath 已提交
6

M
Mislav Marohnić 已提交
7 8
~~~ sh
$ hub clone rtomayko/tilt
C
readme  
Chris Wanstrath 已提交
9

M
Mislav Marohnić 已提交
10 11 12
# expands to:
$ git clone git://github.com/rtomayko/tilt.git
~~~
C
Chris Wanstrath 已提交
13

M
Mislav Marohnić 已提交
14 15
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.
C
tweak  
Chris Wanstrath 已提交
16

C
Chris Wanstrath 已提交
17

M
Mislav Marohnić 已提交
18 19
Installation
------------
C
Chris Wanstrath 已提交
20

M
Mislav Marohnić 已提交
21
Dependencies:
C
Chris Wanstrath 已提交
22

M
Mislav Marohnić 已提交
23
* **git 1.7.3** or newer
C
tweak  
Chris Wanstrath 已提交
24

25 26
#### Homebrew

27
`hub` can be installed through Homebrew:
28 29

~~~ sh
30 31 32 33
$ brew install hub
$ hub version
git version 1.7.6
hub version 2.2.0
34 35
~~~

O
Owen Ou 已提交
36 37
#### Standalone

38
`hub` can be easily installed as an executable. Download the latest
39 40
[compiled binaries](https://github.com/github/hub/releases) and put it anywhere
in your executable path.
O
Owen Ou 已提交
41 42 43

#### Source

44
To install `hub` from source, you need to have a [Go development environment](http://golang.org/doc/install):
O
Owen Ou 已提交
45 46 47 48

~~~ sh
$ git clone https://github.com/github/hub.git
$ cd hub
49 50
# Assuming `~/bin` is in your PATH:
$ ./script/build -o ~/bin/hub
O
Owen Ou 已提交
51 52
~~~

53 54 55 56 57 58 59
Or, if you've done Go development before and your $GOPATH/bin
directory is already in your PATH:

~~~ sh
$ go get github.com/github/hub
~~~

C
Chris Wanstrath 已提交
60 61
Aliasing
--------
C
readme  
Chris Wanstrath 已提交
62

M
Mislav Marohnić 已提交
63 64
Using hub feels best when it's aliased as `git`. This is not dangerous; your
_normal git commands will all work_. hub merely adds some sugar.
C
readme  
Chris Wanstrath 已提交
65

66 67
`hub alias` displays instructions for the current shell. With the `-s` flag, it
outputs a script suitable for `eval`.
C
Chris Wanstrath 已提交
68

69
You should place this command in your `.bash_profile` or other startup script:
C
Chris Wanstrath 已提交
70

M
Mislav Marohnić 已提交
71
~~~ sh
72
eval "$(hub alias -s)"
M
Mislav Marohnić 已提交
73
~~~
C
tweaks  
Chris Wanstrath 已提交
74

75 76 77 78 79
### Shell tab-completion

hub repository contains tab-completion scripts for bash and zsh. These scripts
complement existing completion scripts that ship with git.

80 81
[Installation instructions](etc)

M
Mislav Marohnić 已提交
82 83
* [hub bash completion](https://github.com/github/hub/blob/master/etc/hub.bash_completion.sh)
* [hub zsh completion](https://github.com/github/hub/blob/master/etc/hub.zsh_completion)
84

C
Chris Wanstrath 已提交
85 86
Meta
----
C
readme  
Chris Wanstrath 已提交
87

M
Mislav Marohnić 已提交
88 89 90
* Home: <https://github.com/github/hub>
* Bugs: <https://github.com/github/hub/issues>
* Authors: <https://github.com/github/hub/contributors>
M
Mislav Marohnić 已提交
91 92

### Prior art
C
Chris Wanstrath 已提交
93

M
Mislav Marohnić 已提交
94 95
These projects also aim to either improve git or make interacting with
GitHub simpler:
C
Chris Wanstrath 已提交
96

97
* [hub in Ruby](https://github.com/github/hub/tree/1.12-stable) (previous implementation)
M
Mislav Marohnić 已提交
98 99
* [eg](http://www.gnome.org/~newren/eg/)
* [github-gem](https://github.com/defunkt/github-gem)