I saw a following line in a manifest file in .repo. How can I do the same with the git command in manifest.xml? I'd like to know how to run 'git clone' with specific revision and depth=1.
<project clone-depth="1" groups="pdk-cw-fs,pdk-fs" name="repository name" path="repository path" revision="SHA1"/>
If revision
is a branch( refs/heads/xxx
) or a tag( refs/tags/xxx
),
git clone $remote -b $revision --depth=1 --single-branch
#or
git fetch $remote $revision --depth=1 && git checkout FETCH_HEAD
If revision
is a specific commit or a ref under other namepaces, not refs/tags/
or refs/heads/
,
git fetch $remote $revision --depth=1 && git checkout FETCH_HEAD
Note that when revision
is a specific commit at which no ref is pointing, git fetch
would fail due to error: Server does not allow request for unadvertised object
. The variables in git config
or the hosting service config allow to fetch an unadvertised object:
uploadpack.allowTipSHA1InWant
uploadpack.allowReachableSHA1InWant
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.