당신이 찾고있는 것을 이해하면 - 일회성 변환, 지속적인 통합과 반대 - 이것이 효과가 있습니다. 현재의 로컬 repo에서 작동하도록 조정할 수 있기 때문에 조금 지나치게 비싸지 만 로컬 Repo의 현재 상태에 대한 가정을해야합니다.이 방법을 사용하면 커밋되지 않은 변경으로 인한 충돌을 피할 수 있습니다. 상태 등이 후
git init newrepo # create a new scratch space repo
cd newrepo
git remote add originA <url or relative path of A> # add both original repos as remotes
git remote add originB <url or relative path of B>
git fetch originA master # fetch the branches we want
git fetch originB master
git checkout -b newbranch originB/master # start a new branch from B's master
git merge -s ours originA/master # merge A's master in, but ignore
# the content, so the result is
# exactly B
git push originA newbranch:master # push the new merged head to both
git push originB newbranch:master # original repos
, 임시 저장소를 제거 할 수 있습니다, 정상적인 작업의 repo로 돌아가, 거기 git fetch
/git pull
업데이트. 이 시점에서 A와 B는 함께 병합되었지만 내용은 B가 정확히 무엇인지, 원본 Repos는 병합 된 결과로 업데이트되었습니다 (그리고 A repo는 적어도 master
분기의 경우 중복됩니다). 다른 작업이 없다면 정리할 수 있습니다.) 그 말을하는 또 다른 방법은 당신의 B repo가 이제 A와 B의 완전한 역사를 포함하고 있다는 것입니다. 왜냐하면 어떤 이유로 든 A로 되돌아 가야 할 필요가 있기 때문에 A는 본질적으로 B의 개발을 위해 버려졌습니다.
포스트 커밋 훅 (look up)을 사용하는 것이 가능합니다. B가 갱신되면 B를 끌어 오도록 저장소 A를 호출하고, 그 반대의 경우도 마찬가지입니다. –
질문이 업데이트되었습니다. 참조하십시오. – Ahmad