programing

특정 Git 태그를 복제하는 방법

muds 2023. 5. 26. 22:48
반응형

특정 Git 태그를 복제하는 방법

원본 git-clone(1) 수동 페이지

--branch또한 태그를 사용하여 결과 저장소의 해당 커밋에서 HEAD를 분리할 수 있습니다.

나는 노력했다.

git clone --branch <tag_name> <repo_url>

하지만 그것은 작동하지 않습니다.반환되는 항목:

warning: Remote branch 2.13.0 not found in upstream origin, using HEAD instead

이 매개 변수를 사용하는 방법은 무엇입니까?

git clone --depth 1 --branch <tag_name> <repo_url>

--depth 1선택 사항이지만 해당 버전의 상태만 필요한 경우 해당 버전까지의 모든 기록 다운로드를 건너뛸 수 있습니다.

사용하다--single-branch태그 끝으로 이어지는 기록만 복제하는 옵션입니다.이렇게 하면 불필요한 코드가 복제되는 것을 방지할 수 있습니다.

git clone <repo_url> --branch <tag_name> --single-branch
git clone -b 13.1rc1-Gotham  --depth 1  https://github.com/xbmc/xbmc.git
Cloning into 'xbmc'...
remote: Counting objects: 17977, done.
remote: Compressing objects: 100% (13473/13473), done.
Receiving objects:  36% (6554/17977), 19.21 MiB | 469 KiB/s    

다음보다 빠름:

git clone https://github.com/xbmc/xbmc.git
Cloning into 'xbmc'...
remote: Reusing existing pack: 281705, done.
remote: Counting objects: 533, done.
remote: Compressing objects: 100% (177/177), done.
Receiving objects:  14% (40643/282238), 55.46 MiB | 578 KiB/s

또는

git clone -b 13.1rc1-Gotham  https://github.com/xbmc/xbmc.git
Cloning into 'xbmc'...
remote: Reusing existing pack: 281705, done.
remote: Counting objects: 533, done.
remote: Compressing objects: 100% (177/177), done.
Receiving objects:  12% (34441/282238), 20.25 MiB | 461 KiB/s
git clone --depth 1 --branch <tag_name> <repo_url>

git clone --depth 1 --depth 0.37.2 https://github.com/apache/incubator-superset.git

<tag_name> : 0.37.2

<repo_url> : https://github.com/apache/incubator-superset.git

명령어 사용

git clone --help

깃이 명령을 지원하는지 확인합니다.

git clone --branch tag_name

그렇지 않은 경우 다음을 수행합니다.

git clone repo_url 
cd repo
git checkout tag_name

특정 태그를 복제하면 '분리된 HEAD' 상태가 반환될 수 있습니다.

해결 방법으로 먼저 레포를 복제한 다음 특정 태그를 확인하십시오.예:

repo_url=https://github.com/owner/project.git
repo_dir=$(basename $repo_url .git)
repo_tag=0.5

git clone --single-branch $repo_url # using --depth 1 can show no tags
git --work-tree=$repo_dir --git-dir=$repo_dir/.git checkout tags/$repo_tag

참고: Git 1.8.5 이후, 당신은 사용할 수 있습니다.-C <path>대신에--work-tree그리고.--git-dir.

추천합니다

git clone --depth 1 git@github.com:etlegacy/etlegacy.git --tags 2.80.2 --single-branch 

언급URL : https://stackoverflow.com/questions/20280726/how-to-clone-a-specific-git-tag

반응형