ghqのお作法でリポジトリ管理するのが便利だ便利だと周りで言われているので、やってみた。
Install ghq
Goが入っていない場合は入れる。
$ brew install go
PATH周りを設定して、ghqを入れて設定
$ export GOPATH=$HOME
$ export PATH=$GOPATH/bin:$PATH
$ go get github.com/motemen/ghq
$ git config --global ghq.root ~/src
$ source ~/.zshrc
$ ghq
NAME:
ghq - Manage GitHub repository clones
USAGE:
ghq [global options] command [command options] [arguments...]
VERSION:
HEAD
AUTHOR:
motemen - <motemen@gmail.com>
COMMANDS:
get Clone/sync with a remote repository
list List local repositories
look Look into a local repository
import Bulk get repositories from a file or stdin
help, h Shows a list of commands or help for one command
GLOBAL OPTIONS:
--help, -h show help
--version, -v print the version
$ ghq list -p
/Users/mikiakira/src/github.com/codegangsta/cli
/Users/mikiakira/src/github.com/daviddengcn/go-colortext
/Users/mikiakira/src/github.com/mitchellh/go-homedir
/Users/mikiakira/src/github.com/motemen/ghq
/Users/mikiakira/src/github.com/motemen/go-colorine
良い感じ。
ghqからのpercol移動
$ vim ~/.zshrc
# ghq
function gcd() {
if [[ $1 == "" ]]; then
PERCOL=percol
else
PERCOL="percol --query $1"
fi
cd $(ghq list --full-path | eval $PERCOL)
}
$ source ~/.zshrc
$ gcd
ついでにgem-srcからのpercol移動
$ git clone https://github.com/amatsuda/gem-src.git $RBENV_ROOT/plugins/gem-src
$ rbenv rehash
$ echo "gemsrc_clone_root: ~/src" >> ~/.gemrc
$ gem i kaminari
$ gcd
良い感じ