호호맨
성공보단 성장을.
호호맨
전체 방문자
오늘
어제
  • 분류 전체보기 (38)
    • 개발 (12)
      • Java (7)
      • Spring (1)
      • 패턴 (0)
      • 리팩토링 (1)
      • Git (1)
      • Mac (1)
      • 기타 (1)
    • 글쓰기 (16)
      • 회고록 (13)
      • 독서 (3)
    • 알고리즘 (10)
      • 백준 문제풀이 (10)

블로그 메뉴

  • 홈
  • 태그
  • 방명록

공지사항

인기 글

태그

  • 다익스트라
  • bfs
  • 우테코

최근 댓글

최근 글

티스토리

hELLO · Designed By 정상우.
호호맨

성공보단 성장을.

개발/Git

[Git] 특정 브랜치 Clone하기

2022. 2. 9. 23:28

특정 브랜치 clone

clone 하려는 저장소의 브랜치가 많을 경우 특정한 브랜치만 clone 하는 방법이 있다.

git clone -b {branch_name} --single-branch {repository_url}

예시

 git clone -b yhh1056 --single-branch https://github.com/yhh1056/java-racingcar.git

 

특정 브랜치 추가

single branch로 clone한 뒤 다른 브랜치를 가져오고 싶어 졌다. 원격에 있는 브랜치를 가져오는 방법은 다음과 같다.

git remote set-branches --add origin {remote_branch_name}
git fetch origin {remote_branch_name}:{local_branch_name}

예시

git remote set-branches --add origin develop
git fetch origin develop:develop
    호호맨
    호호맨

    티스토리툴바