LoginSignup
12
12

More than 5 years have passed since last update.

[wip] Git・Githubをより強力にするためのCLIツール

Last updated at Posted at 2014-12-08

Git・Gihubをより強力にするためのCLIツールについて説明します。

目次

  • gh
  • hub
  • github-todos
  • git-extras
  • gitsh
  • git-open

gh

Github - gh

hub

Github - hub

hubのドキュメントにも書いてあるのですがhubをgitのコマンドのエイリアスにすると既存のgitのコマンドを強力にできて便利です。

# alias作成
$ alias git=hub

# 確認 
$ git --version
git version 2.2.0
hub version 1.12.2

Github URL: https://github.com/github/hub

github-todos

簡単にコードに書かれたTODOをGithubのissueに登録できる

Github URL: https://github.com/naholyr/github-todos

インストール

$ npm install -g github-todos

認証

$ [sudo] github-todos config github.token <your token>
$ github-todos auth                                                                                                 
No token found to access Github API. I will now ask for your username and password to generate one.
Those information ARE NOT STORED, only the generated token will be stored in your global git configuration.
If you don't want to let this process go you'll have to generate a token yourself and then save it with 'github-todos config github.token <your token>'.
? Github username: <your username>
? Github password: <your password>
Connection to Github API succeeded

init

$ github-todos init
[Github-Todos] To disable checking credentials on 'init', add option '--no-connect'
[Github-Todos] Hook file not found, create new one…
[Github-Todos] Hook installed
[Github-Todos] Option 'repo' is not set
[Github-Todos] Now guessing initial configuration from remote 'origin'…
[Github-Todos] Will use repository '<your repository>'
[Github-Todos] Run 'github-todos config' to check configuration, you may want to customize 'repo' option
[Github-Todos] OK

確認

$ github-todos config
github.token = <your github token>
repo = <your repository>

はまったところ

問題

pushできない:

$git push
TypeError: Cannot read property 'content' of undefined
error: failed to push some refs to 'git@github.com:<your username>/<your repository>.git'

解決策

最初からやりなし

git-extras

gitのデフォルトにはないがよく使うコマンドを追加してくれるもの

Github URL: https://github.com/tj/git-extras

gitsh

Github - gitsh

毎日のように、$ git ~と入力するのはも面倒なのでそれを解決するのが、gitshです。また既存のaliasなどもこのなかで使用することが可能です。

使い方

$ mkdir test && cd $_
$ touch README.md
$ gitsh
gitsh 0.8
Type :exit to exit
test uninitialized!! ⏎
fatal: Not a git repository (or any of the parent directories): .git

# git init
test uninitialized!! init
Initialized empty Git repository in /Users/sota/Desktop/test/.git/

test master! ⏎
On branch master

Initial commit

Untracked files:
    README.md

nothing added to commit but untracked files present

# git add .
test master! add .

# git commit -m 'Create README'
test master& c 'Create README'
[master (root-commit) 381e857] Create README
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 README.md
test master@ ^D

インストール

$ brew tap thoughtbot/formulae
$ brew install gitsh

git-open

Github - git-open

244a0b72-a3d0-11e4-8ab9-55fc64228aaa.gif

12
12
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
12
12