Shallow clone cannot fetch new commits/branches?

后端 未结 4 2075
南笙
南笙 2021-01-29 07:36

I have this:

git clone --depth=1  app
cd app
git fetch origin
git checkout a119b1076dd45a88a3609c4f7893ef3d82f9a4ee

but it says:

4条回答
  •  不要未来只要你来
    2021-01-29 08:29

    As the docs for --depth says,

    Implies --single-branch unless --no-single-branch is given

    so if you want

    to fetch the histories near the tips of all branches

    give --no-single-branch on your clone, or for one-off correction do the fetch yourself,

    git fetch --depth=1 origin +refs/heads/*:refs/remotes/origin/*
    

    or to retroactively shut off the single-branch setup

    git config remote.origin.fetch +refs/heads/*:refs/remotes/origin/*
    

    and then git fetch.

提交回复
热议问题