본문 바로가기

공부 정리/Git

git 원격 브랜치 모두 로컬로 받아오기

728x90
반응형

*개요

git 원격 브랜치를 모두 로컬로 받아오는 명령어를 확인합니다

 

 

git branch -r | grep -v '\->' | sed "s,\x1B\[[0-9;]*[a-zA-Z],,g" | while read remote; do git branch --track "${remote#origin/}" "$remote"; done
git pull --all

 

첫번째 줄은 명령어 공부를 통해 추후 정리 예정. 

git pull에는 git fetch와 git merge가 합쳐져 있으므로 아래 글의 빨간박스 git fetch --all 부분은 삭제합니다.

 

 

 

https://stackoverflow.com/questions/10312521/how-do-i-fetch-all-git-branches#comment27984640_10312587

 

How do I fetch all Git branches?

I cloned a Git repository containing many branches. However, git branch only shows one: $ git branch * master How would I pull all the branches locally so when I do git branch, it shows the follow...

stackoverflow.com

 

728x90
반응형