ghq: Manage repository clones of GitHub, Google Code on the "Go way"
Every day you checkout source codes of tools, libraries, frameworks or so, to read them with your editor. It should be a good habit, but how do you manage local clones of repositories on GitHub or Google Code? Everytime thinking "this requires git clone
and this one hg clone
..."? In any way, they tend to be messy easily.
So here is one simple idea: do as go get does, but for any languages. And ghq is an implementation of this.
ghq is written in Go, so use go get
to install it:
go get github.com/motemen/ghq
Once installed, you can simply run ghq get REPOSITORY-URL
to get it cloned under ghq's root (configurable by git config ghq.root
, defaults to ~/.ghq
), with a path according to its URL, for example ~/.ghq/github.com/motemen/ghq
.
GitHub including GitHub:Enterprise and Google Code Project repositories (Git and Mercurial) are currently supposed.
% ghq get https://github.com/motemen/ghq
clone https://github.com/motemen/ghq -> /Users/motemen/.ghq/github.com/motemen/ghq
git clone https://github.com/motemen/ghq /Users/motemen/.ghq/github.com/motemen/ghq
Cloning into '/Users/motemen/.ghq/github.com/motemen/ghq'...
You can also list the repositories cloned, and look into one of the workspaces.
$ ghq list go # search local clones by "go"
github.com/google/go-github
code.google.com/p/go.tools
$ ghq look vim
cd /Users/motemen/.ghq/code.google.com/p/vim
$ # Launches a new shell with cwd set to the repo's workspace
And last but not least, ghq has a bulk-cloning feature. With the command below, you can get all the clones of GitHub repositories starred by a specific user.
$ ghq import starred motemen
ghq is yet under a heavy development and any issues or pull requests are welcome. Enjoy!