Git 클론 특정 태그

Stewart Nguyen 2022년8월23일 Git Git Clone Git Tag
Git 클론 특정 태그

이 기사에서는 원격 저장소에서 특정 태그를 복제하는 방법을 배웁니다.

그렇게 하려면 git clone -b <tag> --single-branch <remote_repository> 명령을 사용합니다.

  • -b 옵션은 복제하려는 태그 또는 분기를 허용합니다.
  • --single-branch 옵션은 -b 옵션에서 제공한 태그만 로컬로 복제됨을 나타냅니다. 다른 모든 원격 분기/태그는 무시됩니다.

Git은 복제 후 새 분기를 생성하지 않습니다. 사실, 그것은 단지 태그의 SHA를 참조합니다.

git switch -c <new-branch-name>을 사용하여 태그의 SHA에서 새 분기를 설정하는 것은 우리의 책임입니다.

$ git clone -b v1.0.0 --single-branch git@github.com:stwarts/git-demo.git && cd git-demo Cloning into 'git-demo'... remote: Enumerating objects: 13, done. remote: Counting objects: 100% (13/13), done. remote: Compressing objects: 100% (8/8), done. remote: Total 13 (delta 1), reused 8 (delta 0), pack-reused 0 Receiving objects: 100% (13/13), done. Resolving deltas: 100% (1/1), done. Note: switching to '9265e3bd97863fde0a13084f04163ceceff9a9d0'.  You are in a `detached HEAD` state. You can look around, make experimental changes and commit them, and you can discard any commits you make in this state without impacting any branches by switching back to a branch.  If you want to create a new branch to retain commits you have created, you may do so (now or later) by using -c with the switch command. Example:   git switch -c <new-branch-name>  Or undo this operation with:   git switch -  $ git switch -c branch-off-from-tag-v1.0.0 $ git branch * branch-off-from-tag-v1.0.0 
튜토리얼이 마음에 드시나요? DelftStack을 구독하세요 YouTube에서 저희가 더 많은 고품질 비디오 가이드를 제작할 수 있도록 지원해주세요. 구독하다

관련 문장 - Git Clone

관련 문장 - Git Tag