2009-12-08 08:28:38 +03:00
|
|
|
hub: git + hub = github
|
|
|
|
=======================
|
2009-12-08 00:21:12 +03:00
|
|
|
|
2009-12-09 07:05:17 +03:00
|
|
|
`hub` is a command line utility which adds GitHub knowledge to `git`.
|
2009-12-08 00:21:12 +03:00
|
|
|
|
2009-12-09 07:05:17 +03:00
|
|
|
It can used on its own or as a `git` wrapper.
|
2009-12-08 00:21:12 +03:00
|
|
|
|
2009-12-08 12:12:32 +03:00
|
|
|
Normal:
|
2009-12-08 11:34:29 +03:00
|
|
|
|
|
|
|
$ 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.
|
|
|
|
|
2009-12-09 07:05:17 +03:00
|
|
|
Wrapping `git`:
|
2009-12-08 11:34:29 +03:00
|
|
|
|
|
|
|
$ 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.
|
|
|
|
|
2009-12-09 07:10:12 +03:00
|
|
|
hub requires you have `git` installed and in your path. It also
|
|
|
|
requires Ruby 1.8.6+ or Ruby 1.9.1+. No other libraries are necessary.
|
|
|
|
|
2009-12-08 00:21:12 +03:00
|
|
|
|
2009-12-08 08:28:38 +03:00
|
|
|
Install
|
2009-12-08 00:21:12 +03:00
|
|
|
-------
|
|
|
|
|
2009-12-09 04:40:45 +03:00
|
|
|
### Standalone
|
|
|
|
|
2009-12-09 07:10:12 +03:00
|
|
|
`hub` is most easily installed as a standalone script:
|
2009-12-08 12:12:32 +03:00
|
|
|
|
|
|
|
curl http://defunkt.github.com/hub/standalone > ~/bin/hub && chmod 0755 !$
|
|
|
|
|
2009-12-09 07:05:17 +03:00
|
|
|
Assuming `~/bin/` is in your path, you're ready to roll:
|
2009-12-09 04:40:45 +03:00
|
|
|
|
2009-12-09 07:05:17 +03:00
|
|
|
$ hub version
|
|
|
|
git version 1.6.4.2
|
|
|
|
hub version 0.1.0
|
2009-12-09 04:40:45 +03:00
|
|
|
|
2009-12-09 07:05:17 +03:00
|
|
|
### Rubygems
|
2009-12-08 00:21:12 +03:00
|
|
|
|
2009-12-09 07:05:17 +03:00
|
|
|
Though not recommended, `hub` can also be installed as a Rubygem:
|
2009-12-09 04:34:37 +03:00
|
|
|
|
2009-12-09 07:05:17 +03:00
|
|
|
$ gem install hub -s http://gemcutter.org/
|
2009-12-09 04:34:37 +03:00
|
|
|
|
2009-12-09 04:40:45 +03:00
|
|
|
### Source
|
|
|
|
|
2009-12-09 04:34:37 +03:00
|
|
|
You can also install from source:
|
2009-12-08 00:21:12 +03:00
|
|
|
|
|
|
|
$ git clone git://github.com/defunkt/hub.git
|
|
|
|
$ cd hub
|
2009-12-09 07:05:17 +03:00
|
|
|
$ rake standalone
|
|
|
|
$ cp hub /usr/local/bin/
|
2009-12-08 00:21:12 +03:00
|
|
|
|
|
|
|
|
2009-12-09 04:40:45 +03:00
|
|
|
Aliasing
|
|
|
|
--------
|
2009-12-08 00:21:12 +03:00
|
|
|
|
2009-12-09 07:08:36 +03:00
|
|
|
hub works best when it wraps `git`. This is not dangerous - your
|
|
|
|
normal git commands should all work. hub merely adds some sugar.
|
2009-12-08 00:21:12 +03:00
|
|
|
|
2009-12-09 07:08:36 +03:00
|
|
|
Typing `hub alias <shell>` will display alias instructions for
|
|
|
|
your shell. `hub alias` alone will show the known shells.
|
2009-12-08 00:21:12 +03:00
|
|
|
|
2009-12-09 07:08:36 +03:00
|
|
|
For example:
|
|
|
|
|
|
|
|
$ hub alias bash
|
|
|
|
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
|
2009-12-09 07:31:04 +03:00
|
|
|
script to ensure runs on login.
|
2009-12-09 07:08:36 +03:00
|
|
|
|
|
|
|
The alias command can also be eval'd directly using the `-s` flag:
|
|
|
|
|
|
|
|
$ eval `hub alias -s bash`
|
2009-12-08 12:12:53 +03:00
|
|
|
|
2009-12-08 00:21:12 +03:00
|
|
|
|
2009-12-08 11:18:55 +03:00
|
|
|
Commands
|
2009-12-08 00:21:12 +03:00
|
|
|
--------
|
|
|
|
|
2009-12-09 07:08:36 +03:00
|
|
|
Assuming you've aliased `hub` to `git` the following commands now have
|
2009-12-09 04:40:45 +03:00
|
|
|
superpowers:
|
|
|
|
|
2009-12-08 00:21:12 +03:00
|
|
|
### git clone
|
|
|
|
|
|
|
|
$ git clone schacon/ticgit
|
2009-12-08 11:29:29 +03:00
|
|
|
> git clone git://github.com/schacon/ticgit.git
|
|
|
|
|
2009-12-08 00:21:12 +03:00
|
|
|
$ git clone -p schacon/ticgit
|
2009-12-08 11:29:29 +03:00
|
|
|
> git clone git@github.com:schacon/ticgit.git
|
2009-12-08 00:21:12 +03:00
|
|
|
|
2009-12-09 08:06:34 +03:00
|
|
|
$ git clone resque
|
|
|
|
> git clone git://github.com/YOUR_USER/resque.git
|
|
|
|
|
|
|
|
$ git clone -p resque
|
|
|
|
> git clone git@github.com:YOUR_USER/resque.git
|
|
|
|
|
2009-12-08 00:21:12 +03:00
|
|
|
### git remote add
|
|
|
|
|
|
|
|
$ git remote add rtomayko
|
2009-12-08 11:29:29 +03:00
|
|
|
> git remote add rtomayko git://github.com/rtomayko/CURRENT_REPO.git
|
|
|
|
|
2009-12-08 00:21:12 +03:00
|
|
|
$ git remote add -p pjhyett
|
2009-12-08 11:29:29 +03:00
|
|
|
> git remote add rtomayko git@github.com:rtomayko/CURRENT_REPO.git
|
2009-12-08 00:21:12 +03:00
|
|
|
|
|
|
|
### git init
|
|
|
|
|
2009-12-08 08:28:38 +03:00
|
|
|
$ git init -g
|
2009-12-08 11:29:29 +03:00
|
|
|
> git init
|
2009-12-09 08:06:34 +03:00
|
|
|
> git remote add origin git@github.com:YOUR_USER/REPO.git
|
2009-12-08 11:29:29 +03:00
|
|
|
|
|
|
|
### git help
|
|
|
|
|
|
|
|
$ git help
|
|
|
|
> (improved git help)
|
2009-12-08 00:21:12 +03:00
|
|
|
|
|
|
|
|
2009-12-09 04:40:45 +03:00
|
|
|
GitHub Login
|
|
|
|
------------
|
|
|
|
|
|
|
|
To get the most out of `hub`, you'll want to ensure your GitHub login
|
|
|
|
is stored locally in your Git config.
|
|
|
|
|
|
|
|
To test it run this:
|
|
|
|
|
|
|
|
$ git config --global github.user
|
|
|
|
|
|
|
|
If you see nothing, you need to set the config setting:
|
|
|
|
|
|
|
|
$ git config --global github.user YOUR_USERNAME
|
|
|
|
|
|
|
|
See <http://github.com/guides/local-github-config> for more information.
|
|
|
|
|
|
|
|
|
2009-12-08 11:18:55 +03:00
|
|
|
Prior Art
|
2009-12-08 00:21:12 +03:00
|
|
|
---------
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
|
|
|
|
2009-12-08 11:18:55 +03:00
|
|
|
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!
|
|
|
|
|
|
|
|
|
2009-12-08 08:28:38 +03:00
|
|
|
Meta
|
|
|
|
----
|
2009-12-08 00:21:12 +03:00
|
|
|
|
2009-12-08 11:18:55 +03:00
|
|
|
* 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
|