지점에서 추적하는 원격을 변경하는 방법은 무엇입니까? 그것은 잘못입니다 . 새로운

central저장소 내 지역의 repo에 새 원격을 생성하므로, 새 서버에 설정하고 그에게 밀어했다.

그러나 지금 내가 할 때, 나는 git pull최신 상태라고 주장합니다. 그것은 잘못입니다 . 새로운 원격 분기가 아닌 오래된 원격 분기 에 대해 말하고 있습니다.

다른 리모컨을 추적하기 위해 로컬 지점을 어떻게 변경합니까?

git config 파일에서 이것을 볼 수 있지만 물건을 엉망으로 만들고 싶지 않습니다.

[branch "master"]
    remote = oldserver
    merge = refs/heads/master


답변

git v1.8.0 이상 사용 :

git branch branch_name --set-upstream-to your_new_remote/branch_name

또는 -u스위치를 사용할 수 있습니다 .

git branch branch_name -u your_new_remote/branch_name

git v1.7.12 또는 이전 버전 사용 :

git branch --set-upstream branch_name your_new_remote/branch_name


답변

나를 위해 수정은 다음과 같습니다.

git remote set-url origin https://some_url/some_repo

그때:

git push

답변

최신 git (2.5.5) 에서 명령은 다음과 같습니다.

git branch --set-upstream-to=origin/branch

현재 로컬 지점의 원격 추적 지점이 업데이트됩니다.


답변

발생하는 상황을 많이 제어 할 수있는 또 다른 옵션은 직접 구성을 편집하는 것입니다.

git config --edit

또는 속기

git config -e

그런 다음 원하는대로 파일을 편집하고 저장하면 수정 사항이 적용됩니다.


답변

잘 알고 있다면 구성 파일을 편집해도 안전합니다. 좀 더 편집증이되고 싶다면 porcelain 명령을 사용하여 수정할 수 있습니다.

git config branch.master.remote newserver

물론 이전과 이후의 구성을 살펴보면 구성이 정확히하려는 것을 볼 수 있습니다.

그러나 당신의 개인적인 경우에, 내가 할 일은 :

git remote rename origin old-origin
git remote rename new-origin origin

즉, 새 서버가 표준 원격 서버가 될 경우 원래 서버에서 복제 한 것처럼 서버를 오리진이라고 부르지 않겠습니까?


답변

git fetch origin
git checkout --track -b local_branch_name origin/branch_name

또는

git fetch
git checkout -b local_branch_name origin/branch_name

답변

가장 쉬운 명령입니다.

git push --set-upstream <new-origin> <branch-to-track>

예를 들어, 명령 git remote -v이 다음과 같이 생성 되면 :

origin  ssh://git@bitbucket.some.corp/~myself/projectr.git (fetch)
origin  ssh://git@bitbucket.some.corp/~myself/projectr.git (push)
team    ssh://git@bitbucket.some.corp/vbs/projectr.git (fetch)
team    ssh://git@bitbucket.some.corp/vbs/projectr.git (push)

대신 팀 추적으로 변경하려면 다음을 수행하십시오.

git push --set-upstream team master