GitHub | Command Line で GitHub を操作する hub の基礎
概要
Command Line で GitHub を操作する hub の基礎
hub とは?
git コマンドに GitHub とのやり取りを便利にするコマンドを追加します。
これにより、GitHub を利用した開発の効率があがります。
Images
Before
After
Installation
バイナリをダウンロードして、パスが通った場所に配置します。
Confirm Installation
機能の確認がてら、 help command で動作確認をします。
$ hub help | tail -12
GitHub Commands:
pull-request Open a pull request on GitHub
fork Make a fork of a remote repository on GitHub and add as remote
create Create this repository on GitHub and add GitHub as origin
browse Open a GitHub page in the default browser
compare Open a compare page on GitHub
release List or create releases (beta)
issue List or create issues (beta)
ci-status Show the CI status of a commit
See 'git help <command>' for more information on a specific command.
Settings
alias の追加
hub を利用する際は、 alias によって git command として扱います。
これにより、 git command は今まで通り利用しつつ、
hub の機能を追加することができます。
.bashrc などに下記設定を追加します。
eval "$(hub alias -s)"
- git command を呼び出して、 hub の機能が追加されたことを確認します
$ . ~/.bashrc
$ git help | tail -12
GitHub Commands:
pull-request Open a pull request on GitHub
fork Make a fork of a remote repository on GitHub and add as remote
create Create this repository on GitHub and add GitHub as origin
browse Open a GitHub page in the default browser
compare Open a compare page on GitHub
release List or create releases (beta)
issue List or create issues (beta)
ci-status Show the CI status of a commit
See 'git help <command>' for more information on a specific command.
サブコマンドの入力補完を設定
bash, zsh の入力補完がサポートされています。
bash の場合は、下記を .bashrc に設定します。
$ wget -O ~/.hub.bash_completion.sh https://raw.githubusercontent.com/github/hub/master/etc/hub.bash_completion.sh
これで、git / hub のコマンドを補完可能になりました。
デモ
私の自作 gem である tbpgr_utils の Issue を取得してみます。1
git i
後に、タブを入力してコード補完を呼び出していることを確認できます。
脚注
-
tbpgr_utils は実用 gem ではない ↩
Author And Source
この問題について(GitHub | Command Line で GitHub を操作する hub の基礎), 我々は、より多くの情報をここで見つけました https://qiita.com/tbpgr/items/d827c18216f40778db85著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .