Transfer local repositories from flatten directory style to ghq convention style.
% ghq_transfer [--dry-run] [--valth]
Options:
--dry-run
... Dry run mode (First of all, You'll run this)--valth
... Apply mode
The --dry-run
option overrides the --valth
option if both are used.
Example effect:
For example, your ghq root
is ~/.ghq
.
Following the dry run mode.
% ghq_transfer --dry-run
*** dry run ***
/Users/account/.ghq/rabbit -> /Users/account/.ghq/github.com/rabbit-shocker/rabbit
/Users/account/.ghq/racc -> /Users/account/.ghq/github.com/tenderlove/racc
/Users/account/.ghq/rack -> /Users/account/.ghq/github.com/rack/rack
/Users/account/.ghq/rack-attack -> /Users/account/.ghq/github.com/kickstarter/rack-attack
/Users/account/.ghq/rack-cache -> /Users/account/.ghq/github.com/rtomayko/rack-cache
/Users/account/.ghq/rack-mini-profiler -> /Users/account/.ghq/github.com/MiniProfiler/rack-mini-profiler
/Users/account/.ghq/rack-pjax -> /Users/account/.ghq/github.com/eval/rack-pjax
/Users/account/.ghq/rack-protection -> /Users/account/.ghq/github.com/rkh/rack-protection
/Users/account/.ghq/rack-test -> /Users/account/.ghq/github.com/brynary/rack-test
/Users/account/.ghq/rails -> /Users/account/.ghq/github.com/rails/rails
These ghq convention layout decisions based on git config --get remote.origin.url
of each repositories.
Apply the ghq convention layout to your ghq root
repositories.
% ghq_transfer --valth
*** valth!! ***
/Users/account/.ghq/rabbit -> /Users/account/.ghq/github.com/rabbit-shocker/rabbit
/Users/account/.ghq/racc -> /Users/account/.ghq/github.com/tenderlove/racc
/Users/account/.ghq/rack -> /Users/account/.ghq/github.com/rack/rack
/Users/account/.ghq/rack-attack -> /Users/account/.ghq/github.com/kickstarter/rack-attack
/Users/account/.ghq/rack-cache -> /Users/account/.ghq/github.com/rtomayko/rack-cache
/Users/account/.ghq/rack-mini-profiler -> /Users/account/.ghq/github.com/MiniProfiler/rack-mini-profiler
/Users/account/.ghq/rack-pjax -> /Users/account/.ghq/github.com/eval/rack-pjax
/Users/account/.ghq/rack-protection -> /Users/account/.ghq/github.com/rkh/rack-protection
/Users/account/.ghq/rack-test -> /Users/account/.ghq/github.com/brynary/rack-test
/Users/account/.ghq/rails -> /Users/account/.ghq/github.com/rails/rails
🌟 Execute apply mode after dry run mode, strongly recommended.
Add these lines to your application's Gemfile:
gem 'ghq_transfer'
And then execute:
% bundle
Or install it yourself as:
% gem install ghq_transfer
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
ghq_transfer is released under the MIT License.