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
'IT > Git' 카테고리의 다른 글
[Git] stash 일부만 하기 (0) | 2022.12.16 |
---|---|
[Git] 브랜치 병합 (0) | 2022.08.12 |
[Git] 브랜치 생성, 이동, 확인 (0) | 2022.08.12 |
[Git] 작업 되돌리기 (0) | 2022.08.12 |
[Git] 커밋 메세지 수정 및 상세보기 (0) | 2022.08.11 |