ghq でリポジトリ管理していて、フォルダ整理したくなったので調べながら書いたコマンド集
ghq root/github.com/hoge/fuga のような階層になっていること前提
cd $(ghq root)
find . -type d -maxdepth 3 -mindepth 3 | xargs -I@ bash -c '[ -e @/.git ] || echo @'
ググったら良さそうなツールがあった
fboender/multi-git-status: Show uncommitted, untracked and unpushed changes for multiple Git repos
ghq get fboender/multi-git-status
cd $(ghq root)
github.com/fboender/multi-git-status/mgitstatus -d 3
https://leanpub.com/ghq-handbook を読んで勉強になった。
ghq list | ghq get --update --parallel
-n
は確認用。問題なさそうなら -f
にして実行
untracked なファイルを削除
ghq list --full-path --vcs=git | xargs -I@ bash -c 'echo @ && git -C @ clean -d -n'
.gitignore
で無視しているファイル・フォルダのみ対象にする。 node_modules
とか dist
とか。
ghq list --full-path --vcs=git | xargs -I@ bash -c 'echo @ && git -C @ clean -X -d -n'