hub
- git + hub = github
hub
COMMAND OPTIONS
hub alias
[-s
] SHELL
git init -g
OPTIONS
git clone
[-p
] OPTIONS [USER/]REPOSITORY DIRECTORY
git remote add
[-p
] OPTIONS USER[/REPOSITORY]
git fetch
USER-1,[USER-2,...]
git cherry-pick
GITHUB-REF
git push
REMOTE-1,REMOTE-2,...,REMOTE-N REF
git browse
[-p
] [-u
] [[USER/
]REPOSITORY] [SUBPAGE]
git compare
[-p
] [-u
] [USER] [START...]END
git submodule add
[-p
] OPTIONS [USER/]REPOSITORY DIRECTORY
git fork
[--no-remote
]
hub
enhances various git
commands with GitHub remote expansion. The
alias command displays information on configuring your environment:
hub alias
[-s
] SHELLWrites shell aliasing code for SHELL (bash
, sh
, zsh
,
csh
) to standard output. With the -s
option, the output of
this command can be evaluated directly within the shell:
eval $(hub alias -s bash)
git init
-g
OPTIONSCreate a git repository as with git-init(1) and add remote origin
at
"git@github.com:USER/REPOSITORY.git"; USER is your GitHub username and
REPOSITORY is the current working directory's basename.
git clone
[-p
] OPTIONS [USER/
]REPOSITORY DIRECTORYClone repository "git://github.com/USER/REPOSITORY.git" into
DIRECTORY as with git-clone(1). When USER/ is omitted, assumes
your GitHub login. With -p
, use private remote
"git@github.com:USER/REPOSITORY.git".
git remote add
[-p
] OPTIONS USER[/
REPOSITORY]Add remote "git://github.com/USER/REPOSITORY.git" as with
git-remote(1). When /REPOSITORY is omitted, the basename of the
current working directory is used. With -p
, use private remote
"git@github.com:USER/REPOSITORY.git". If USER is "origin"
then uses your GitHub login.
git fetch
USER-1,[USER-2,...]Adds missing remote(s) with git remote add
prior to fetching. New
remotes are only added if they correspond to valid forks on GitHub.
git cherry-pick
GITHUB-REFCherry-pick a commit from a fork using either full URL to the commit
or GitHub-flavored Markdown notation, which is user@sha
. If the remote
doesn't yet exist, it will be added. A git fetch <user>
is issued
prior to the cherry-pick attempt.
git push
REMOTE-1,REMOTE-2,...,REMOTE-N REFPush REF to each of REMOTE-1 through REMOTE-N by executing
multiple git push
commands.
git browse
[-p
] [-u
] [[USER/
]REPOSITORY] [SUBPAGE]Open repository's GitHub page in the system's default web browser
using open(1)
or the BROWSER
env variable. Use -p
to open a
page with https. If the repository isn't specified, browse
opens
the page of the repository found in the current directory. If SUBPAGE
is specified, the browser will open on the specified subpage: one of
"wiki", "commits", "issues" or other (the default is "tree").
git compare
[-p
] [-u
] [USER] [START...]ENDOpen a GitHub compare view page in the system's default web browser. START to END are branch names, tag names, or commit SHA1s specifying the range of history to compare. If START is omitted, GitHub will compare against the base branch (the default is "master").
git submodule add
[-p
] OPTIONS [USER/]REPOSITORY DIRECTORYSubmodule repository "git://github.com/USER/REPOSITORY.git" into
DIRECTORY as with git-submodule(1). When USER/ is omitted, assumes
your GitHub login. With -p
, use private remote
"git@github.com:USER/REPOSITORY.git".
git fork
[--no-remote
]Forks the original project (referenced by "origin" remote) on GitHub and
adds a new remote for it under your username. Requires github.token
to
be set (see CONFIGURATION).
git help
Display enhanced git-help(1).
Use git-config(1) to display the currently configured GitHub username:
$ git config --global github.user
Or, set the GitHub username and token with:
$ git config --global github.user <username>
$ git config --global github.token <token>
See http://github.com/guides/local-github-config for more information.
You can also tell hub
to use http://
rather than git://
when
cloning:
$ git config --global --bool hub.http-clone true
$ git clone schacon/ticgit
> git clone git://github.com/schacon/ticgit.git
$ git clone -p schacon/ticgit
> git clone git@github.com:schacon/ticgit.git
$ 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
$ git remote add rtomayko
> git remote add rtomayko git://github.com/rtomayko/CURRENT_REPO.git
$ git remote add -p rtomayko
> git remote add rtomayko git@github.com:rtomayko/CURRENT_REPO.git
$ git remote add origin
> git remote add origin git://github.com/YOUR_USER/CURRENT_REPO.git
$ git fetch mislav
> git remote add mislav git://github.com/mislav/REPO.git
> git fetch mislav
$ git fetch mislav,xoebus
> git remote add mislav ...
> git remote add xoebus ...
> git fetch --multiple mislav xoebus
$ git cherry-pick http://github.com/mislav/REPO/commit/SHA
> git remote add -f mislav git://github.com/mislav/REPO.git
> git cherry-pick SHA
$ git cherry-pick mislav@SHA
> git remote add -f mislav git://github.com/mislav/CURRENT_REPO.git
> git cherry-pick SHA
$ git cherry-pick mislav@SHA
> git fetch mislav
> git cherry-pick SHA
$ git fork
... hardcore forking action ...
> git remote add YOUR_USER git@github.com:YOUR_USER/CURRENT_REPO.git
$ git init -g
> git init
> git remote add origin git@github.com:YOUR_USER/REPO.git
$ git push origin,staging,qa bert_timeout
> git push origin bert_timeout
> git push staging bert_timeout
> git push qa bert_timeout
$ git browse
> open http://github.com/CURRENT_REPO
$ git browse -- issues
> open http://github.com/CURRENT_REPO/issues
$ git browse schacon/ticgit
> open http://github.com/schacon/ticgit
$ git browse -p schacon/ticgit
> open https://github.com/schacon/ticgit
$ git browse resque
> open http://github.com/YOUR_USER/resque
$ git browse resque network
> open http://github.com/YOUR_USER/resque/network
$ git browse -p resque
> open https://github.com/YOUR_USER/resque
$ git compare refactor
> open http://github.com/CURRENT_REPO/compare/refactor
$ git compare 1.0...1.1
> open http://github.com/CURRENT_REPO/compare/1.0...1.1
$ git compare -u fix
> (http://github.com/CURRENT_REPO/compare/fix)
$ git compare other-user patch
> open http://github.com/other-user/REPO/compare/patch
$ git help
> (improved git help)
$ git help hub
> (hub man page)
http://github.com/defunkt/hub/issues
Chris Wanstrath :: chris@ozmm.org :: @defunkt
git(1), git-clone(1), git-remote(1), git-init(1), http://github.com, http://github.com/defunkt/hub