LoginSignup
6
8

More than 5 years have passed since last update.

できる限り git shallow clone で頑張る話

Posted at

巨大な git レポジトリがあった場合に、できる限りそれを fetch することはさけたい。必要な branch だけ、 shallow clone して利用したい。その際に次のようにすればいいだろう、というメモ。


git shallow clone した場合、素直に fetch しても、最初に clone してきたときの branch しか取得できない。

.git/config の [remote "name"] の fetch を複数個化すれば、その分だけ fetch してくれるようになる。

これを変更する正規の手順は、 git remote set-branches.


git には、 clone せずとも、 remote の branch をリスト表示する機能がある。

git ls-remote --tags git://github.com/git/git.git

これと組み合わせれば、最小限の branch だけを手元に置きながら作業ができる。

6
8
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
6
8