특정 브랜치 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