IT/Git
[Git] 원격 브랜치 가져오기
올빼밋.
2022. 9. 20. 15:01
728x90
처음 클론할때 --single-branch 를 해서 원격 브랜치가 하나밖에 없는 경우,
git remote set-branches --add origin newbranch
git fetch origin
git checkout --track origin/newbranch
위의 명령어를 통해 원격 브랜치를 가져올 수 있었다.
다른 블로그에도 비슷한 방법이 있는데,
git remote set-branches --add origin [remote-branch]
git fetch origin [remote-branch]:[local-branch]
다음과 같이 해도 된다
fatal: 'origin/main' is not a commit and a branch 'main' cannot be created from it
왜 switch가 안 돼죠?? 에서 시작해서 git Refspec까지 찾아본 이야기
velog.io
출처 : https://www.slipp.net/questions/605
git을 single branch로 clone한 후 새로운 브랜츠를 추가하고 싶은 경우
git에서 브랜치가 너무 많아 특정 브랜치만 추적하도록 clone할 수 있다. git clone -b --single-branch 위와 같이 clone한 후 새로운 브랜치를 추가하고 싶은 경우가 있으면 다음과 같이 새로운 브랜치를 추
www.slipp.net
728x90