Pull updates with git after cloned with --depth 1

前端 未结 2 1866
旧时难觅i
旧时难觅i 2020-12-24 00:45

This morning I made a shallow clone of the Linux sources

git clone --depth 1 https://github.com/torvalds/linux.git

which resulted in a

相关标签:
2条回答
  • 2020-12-24 01:25

    I think you can use --depth 1 in git pull too, so it gets just what's needed for the newest commit in the repository.

    I don't know if the default behaviour is to pull everything missing, because my git help pull shows this option:

    git pull --unshallow
    

    or

    git fetch  --unshallow
    

    --unshallow Convert a shallow repository to a complete one, removing all the limitations imposed by shallow repositories.

    I'm running git version 1.8.5.2 (Apple Git-48), and maybe this is some sort-of-new behaviour, and changing a bit between versions.

    0 讨论(0)
  • 2020-12-24 01:34

    Could any of the new commits be merge-commits pointing to commits not present in your tree? Perhaps --depth 1000 would work better and still be small enough.

    0 讨论(0)
提交回复
热议问题