提交 28b64ba9 编写于 作者: M Mislav Marohnić

reword and reorganize Readme

上级 ebee2c20
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!
...@@ -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
Run this in your shell to start using `hub` as `git`:
alias git=hub 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
------------ -------------
To get the most out of `hub`, you'll want to ensure your GitHub login ### GitHub username & token
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 # opt into HTTPS:
$ git clone defunkt/repl $ git config --global hub.protocol https
< https clone > $ git clone defunkt/repl
< https clone >
Prior Art ~~~
---------
These projects also aim to either improve git or make interacting with
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.
先完成此消息的编辑!
想要评论请 注册