README.md 3.4 KB
Newer Older
C
Chris Wanstrath 已提交
1 2
hub: git + hub = github
=======================
C
readme  
Chris Wanstrath 已提交
3

C
Chris Wanstrath 已提交
4 5
`hub` is a command line utility which injects `git` with GitHub
knowledge.
C
readme  
Chris Wanstrath 已提交
6

C
Chris Wanstrath 已提交
7 8
It can used on its own or can serve as a complete, backwards
compatible replacement for the `git` script.
C
readme  
Chris Wanstrath 已提交
9

C
Chris Wanstrath 已提交
10
Normal:
C
Chris Wanstrath 已提交
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29

    $ hub clone rtomayko/tilt
    Initialized empty Git repository in /Users/chris/sandbox/tilt/.git/
    remote: Counting objects: 307, done.
    remote: Compressing objects: 100% (219/219), done.
    remote: Total 307 (delta 175), reused 85 (delta 45)
    Receiving objects: 100% (307/307), 48.91 KiB, done.
    Resolving deltas: 100% (175/175), done.

Aliased:

    $ git clone rack/rack
    Initialized empty Git repository in /Users/chris/sandbox/rack/.git/
    remote: Counting objects: 4005, done.
    remote: Compressing objects: 100% (1738/1738), done.
    remote: Total 4005 (delta 2505), reused 3620 (delta 2208)
    Receiving objects: 100% (4005/4005), 785.82 KiB | 129 KiB/s, done.
    Resolving deltas: 100% (2505/2505), done.

C
readme  
Chris Wanstrath 已提交
30

C
Chris Wanstrath 已提交
31
Install
C
readme  
Chris Wanstrath 已提交
32 33
-------

C
Chris Wanstrath 已提交
34
`hub` can be installed most easily as a stand alone script:
C
Chris Wanstrath 已提交
35 36 37

    curl http://defunkt.github.com/hub/standalone > ~/bin/hub && chmod 0755 !$

C
tweaks  
Chris Wanstrath 已提交
38
It also can be installed using Rubygems:
C
readme  
Chris Wanstrath 已提交
39

C
Chris Wanstrath 已提交
40
    $ gem install hub -s http://gemcutter.org/
C
readme  
Chris Wanstrath 已提交
41

C
Chris Wanstrath 已提交
42 43 44 45 46 47
Once you have the gem installed you will probably want to install the
standalone script, to avoid the Rubygems startup tax:

    $ hub install standalone

You can also install from source:
C
readme  
Chris Wanstrath 已提交
48 49 50

    $ git clone git://github.com/defunkt/hub.git
    $ cd hub
C
Chris Wanstrath 已提交
51
    $ rake install_standalone
C
readme  
Chris Wanstrath 已提交
52 53 54 55

Once you've installed `hub`, you can invoke it directly from the
command line:

C
Chris Wanstrath 已提交
56
    $ hub version
C
readme  
Chris Wanstrath 已提交
57 58 59 60 61 62 63

To get the full experience, alias your `git` command to run `hub` by
placing the following in your `.bash_profile` (or relevant startup
script):

    alias git=hub

C
Chris Wanstrath 已提交
64
Typing `hub alias <shell>` will display alias instructions for you
C
readme  
Chris Wanstrath 已提交
65 66
shell.

C
tweaks  
Chris Wanstrath 已提交
67 68 69 70
Note that if you're running `hub` under Rubygems, it may be
slow. Installing the standalone script is the fastest (and
recommended) method.

C
readme  
Chris Wanstrath 已提交
71

C
Chris Wanstrath 已提交
72
Commands
C
readme  
Chris Wanstrath 已提交
73 74 75 76 77
--------

### git clone

    $ git clone schacon/ticgit
C
Chris Wanstrath 已提交
78 79
    > git clone git://github.com/schacon/ticgit.git

C
readme  
Chris Wanstrath 已提交
80
    $ git clone -p schacon/ticgit
C
Chris Wanstrath 已提交
81
    > git clone git@github.com:schacon/ticgit.git
C
readme  
Chris Wanstrath 已提交
82 83 84 85

### git remote add

    $ git remote add rtomayko
C
Chris Wanstrath 已提交
86 87
    > git remote add rtomayko git://github.com/rtomayko/CURRENT_REPO.git

C
readme  
Chris Wanstrath 已提交
88
    $ git remote add -p pjhyett
C
Chris Wanstrath 已提交
89
    > git remote add rtomayko git@github.com:rtomayko/CURRENT_REPO.git
C
readme  
Chris Wanstrath 已提交
90 91 92

### git init

C
Chris Wanstrath 已提交
93
    $ git init -g
C
Chris Wanstrath 已提交
94 95 96 97 98 99 100
    > git init
    > git remote add origin git@github.com:USER/REPO.git

### git help

    $ git help
    > (improved git help)
C
readme  
Chris Wanstrath 已提交
101 102


C
Chris Wanstrath 已提交
103
Prior Art
C
readme  
Chris Wanstrath 已提交
104 105 106 107 108 109 110 111 112 113
---------

These projects also aim to either improve git or make interacting with
GitHub simpler:

* [eg](http://www.gnome.org/~newren/eg/)
* [github-gem](http://github.com/defunkt/github-gem)
* [gh](http://github.com/visionmedia/gh)


C
Chris Wanstrath 已提交
114 115 116 117 118 119 120 121 122 123 124 125
Contributing
------------

Once you've made your great commits:

1. [Fork][0] hub
2. Create a topic branch - `git checkout -b my_branch`
3. Push to your branch - `git push origin my_branch`
4. Create an [Issue][1] with a link to your branch
5. That's it!


C
Chris Wanstrath 已提交
126 127
Meta
----
C
readme  
Chris Wanstrath 已提交
128

C
Chris Wanstrath 已提交
129 130 131 132 133 134 135 136 137 138 139 140 141 142
* Code: `git clone git://github.com/defunkt/hub.git`
* Home: <http://github.com/defunkt/hub>
* Bugs: <http://github.com/defunkt/hub/issues>
* List: <http://groups.google.com/group/github>
* Gems: <http://gemcutter.org/gems/hub>


Author
------

Chris Wanstrath :: chris@ozmm.org :: @defunkt

[0]: http://help.github.com/forking/
[1]: http://github.com/defunkt/hub/issues