program story

-단일 분기 클론을 "실행 취소"하려면 어떻게합니까?

inputbox 2020. 10. 21. 08:01
반응형

-단일 분기 클론을 "실행 취소"하려면 어떻게합니까?


나는

git clone -b <branch name> --single-branch <github url> <target directory>

이 브랜치 만 복제했지만 이제 마스터 및 다른 브랜치로 전환하고 싶습니다. --single-branch 기본 설정을 취소 할 수있는 나머지 리포지토리를 복제하기 위해 다시 시작하는 것 외에 다른 방법이 있습니까?


Git에게 다음과 같이 모든 분기를 가져 오도록 지시 할 수 있습니다.

git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
git fetch origin

.git/config보면 다음과 같이 보일 것입니다.

[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
    ignorecase = true
    precomposeunicode = false
[remote "origin"]
    url = https://github.com/owner/repo.git
    fetch = +refs/heads/master:refs/remotes/origin/master
[branch "master"]
    remote = origin
    merge = refs/heads/master
    rebase = true

나는 이것을 전체 클론과 비교했고 유일한 차이점은 [remote "origin"].

참고 : Git 버전 1.8.2를 실행하고 있습니다. 이전 버전의 Git을 실행중인 경우 구성 옵션이 변경되었을 수 있습니다. 내 명령이 작동하지 않으면 .git/config비슷한 것을 볼 수 있는지 살펴 보는 것이 좋습니다 .


단일 분기를 추가하려는 경우 다음을 수행 할 수 있습니다.

git remote set-branches --add origin [remote-branch]
git fetch origin [remote-branch]:[local-branch]

git 버전 1.9.1에서 작동


원래 repo를 새 리모컨으로 추가하고 거기서 작업 하시겠습니까?

git remote add path/to/myrepo myNewOrigin
git fetch myNewOrigin

현재 'origin'리모컨을 삭제하고 원한다면 'myNewOrigin'의 이름을 'origin'으로 바꿀 수도 있습니다.

거기에서 풀 / 병합 / 리베이스 할 수 있습니다.

참고 URL : https://stackoverflow.com/questions/17714159/how-do-i-undo-a-single-branch-clone

반응형