git

single branch로 clone 후 다른 branch 가져오기

rockettttman 2021. 9. 28. 10:45

프로젝트 수행 시 single branch로 작업하던 도중 다른 branch 를 가져올 일이 생겼다. clone자체를 single branch로 했기 때문인지 remote update와 같은 명령어는 해도 소용이 없었는데 아래와 같이 수행하면 가져올 수 있었다.

가져올 브랜치 : dev_front

git remote set-branches --add origin dev_front

git fetch origin dev_front  

후 git branch -a 로 브랜치 리스트를 확인하면 위에 가져온 브랜치가 추가된 것을 확인할 수 있다.

마지막으로

git checkout dev_front를 해주면 끝.

 

참고 

https://velog.io/@solar/Single-branch%EB%A1%9C-Clone-%ED%9B%84-%EC%83%88%EB%A1%9C%EC%9A%B4-%EB%B8%8C%EB%9E%9C%EC%B9%98-%EC%B6%94%EA%B0%80