2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

ghqで複数のリポジトリ管理をスマートに行う

Last updated at Posted at 2016-02-09

gitコマンドでクローンしていたのですが、便利なghqを教えてもらったので記載しておきます。

ghqとは

gitを使っているとgithubやgithubEnterpriseなど複数のリポジトリを管理することがよくあるとおもいます。そんなときにソースの置き場とcloneを楽にするツールがghq。下記画像にあるようにcloneするとディレクトリ構造を自動で作成してくれるため、どのドメインのソースをクローンしたのかわかりやすいです。ちなみにcloneに特化しているため、checkoutやpushなどの機能はありません。

スクリーンショット-2016-02-09-13.55.52.png

Goをインストール

brew install go
echo 'export GOPATH=$HOME' >> ~/.bashrc
echo 'export PATH=$PATH:$GOPATH/bin' >> ~/.bashrc
source ~/.bashrc

私はbashrcで管理していますが、他のファイルを利用している方は名前を変えていただければと思います。

ghqをインストール

go get github.com/motemen/ghq

ghqの管理ディレクトリを設定

git config --global ghq.root ~/src

ghqで管理するrootディレクトリを設定できます。私の場合は~/srcではなく~/Developmentにしました。

ghqでcloneする

ghq get リポジトリパス

便利ですね!

2
2
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
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?