git에서 브랜치가 너무 많아 특정 브랜치만 추적하도록 clone할 수 있다.
git clone -b <branch name> --single-branch <github url> <target directory>
위와 같이 clone한 후 새로운 브랜치를 추가하고 싶은 경우가 있으면 다음과 같이 새로운 브랜치를 추가할 수 있다.
git remote set-branches --add origin [remote-branch]
git fetch origin [remote-branch]:[local-branch]
git clone -b blossun --single-branch https://github.com/blossun/java-monster-race
git checkout blossun
git branch -d step2
git fetch origin step2:step2
origin/step2 브랜치도 보이는 것을 확인할 수 있다.
참고
솔라
저기 콜론이 1개만 들어가야 하는데 2개 들어간 걸로 오타났어!
나 망한 줄 알고 식겁했어 진짜🤣