How do fetch remote branch after I cloned repo with git clone --depth 1

后端 未结 2 1804
时光取名叫无心
时光取名叫无心 2021-01-18 19:21

I\'ve repo with long history so I cloned using

git clone  --depth 1

Now I\'m in the master branch.

How do I fetc

2条回答
  •  无人及你
    2021-01-18 19:45

    You could try forcing it by specifying the fetch depth:

    git fetch --depth=999999
    

    depth is the number of commits. Note that when you did a clone, clone actually does a fetch and the depth is the same depth specified in your fetch.

    Make that number bigger if needed!

    EDIT

    Also you can/probably-should use deepen - same syntax, but it effectively fetches from where your last specified depth left off.. so its a bit more efficient:

    git fetch --deepen=999999
    

    It might depend on your git version though for that last one....

    EDIT 2

    Just saw this while I was reviewing the git docs....

    git fetch --unshallow
    

    This would be the best way (not sure which version it is implemented in and I have not tried it.... but looks like the thing to use).

提交回复
热议问题