2010-05-08 2 views
12

git-svn 및 github을 사용하여 업스트림 SVN 변경 사항을 추적하려면 어떻게합니까?git-svn 및 github을 사용하여 업스트림 svn 변경 사항을 추적 하시겠습니까?

$ git svn clone -s http://svn.osqa.net/svnroot/osqa/ osqa 
$ cd osqa 
$ git remote add origin [email protected]:turian/osqa.git 
$ git push origin master 

가 그때 최선을 다하고 내 자식의 repo에 몇 가지 변경을하고 github에 푸시 :

나는 GitHub의에 이눔하는 SVN의 REPO를 변환하는 자식-SVN을 사용했다.

이제 새 컴퓨터를 사용 중입니다. SVN 변경 사항을 업스트림으로 가져 와서 github 저장소와 병합하여 github 저장소로 옮기고 싶습니다. This documentation은 다음과 같이 말합니다. "로컬 복사본을 잃어버린 경우 같은 설정으로 가져 오기를 다시 실행하면 모든 필요한 SVN 메타 정보가 포함 된 다른 작업 디렉토리가 생깁니다."

그래서 다음을 수행했습니다. 그러나 명령의 아무도 원하는대로 작동하지 않습니다. git-svn 및 github를 사용하여 업스트림 SVN 변경 사항을 추적하려면 어떻게합니까? 내가 도대체 ​​뭘 잘못하고있는 겁니까?

$ git svn clone -s http://svn.osqa.net/svnroot/osqa/ osqa 
$ cd osqa 
$ git remote add origin [email protected]:turian/osqa.git 
$ git push origin master 
To [email protected]:turian/osqa.git 
! [rejected]  master -> master (non-fast forward) 
error: failed to push some refs to '[email protected]:turian/osqa.git' 
$ git pull 
remote: Counting objects: 21, done. 
remote: Compressing objects: 100% (17/17), done. 
remote: Total 17 (delta 7), reused 9 (delta 0) 
Unpacking objects: 100% (17/17), done. 
From [email protected]:turian/osqa 
* [new branch]  master  -> origin/master 
From [email protected]:turian/osqa 
* [new tag]   master  -> master 
You asked me to pull without telling me which branch you 
want to merge with, and 'branch.master.merge' in 
your configuration file does not tell me either. Please 
name which branch you want to merge on the command line and 
try again (e.g. 'git pull <repository> <refspec>'). 
See git-pull(1) for details on the refspec. 
... 
$ /usr//lib/git-core/git-svn rebase 
warning: refname 'master' is ambiguous. 
First, rewinding head to replay your work on top of it... 
Applying: Added forum/management/commands/dumpsettings.py 
error: Ref refs/heads/master is at 6acd747f95aef6d9bce37f86798a32c14e04b82e but expected a7109d94d813b20c230a029ecd67801e6067a452 
fatal: Cannot lock the ref 'refs/heads/master'. 
Could not move back to refs/heads/master 
rebase refs/remotes/trunk: command returned error: 1 

답변

5

리베이스의 경우를 제외하고는 모든 것이 예상대로 발생했지만 기대했던 것보다 훨씬 많은 표현이있는 것처럼 보입니다. 다음은 새 컴퓨터에서 비트를 생성/통합하는 방법입니다.

  1. Svn 저장소를 복제합니다. 이상적으로, 나는 당신의 것이고 알려진 상태에 있기 때문에 자식 repo로 시작하고 싶습니다만, 처음에의 내용을 복제하는 것보다 Svn에서 내용을 가져올 수는 없습니다. 복제 할 때 --prefix=svn/을 추가하여 Svn의 모든 원격 지점에 주석이 추가되도록합니다.
  2. 출처를 추가하십시오 (마치 완료 한 것처럼).
  3. 작동을위한 로컬 분기를 만듭니다. git co -b local-branch svn/branchname. 이제는 물건을 가지고 노는 멋진 지역이 있습니다.
  4. 방금 ​​작성한 로컬 지사에 있어야합니다 (반드시 있어야 함).
  5. Github에서 당기기. 당신은 이것을 정확하게했지만 애매하게합니다. 모호성을 제거하려면 명시 적으로 git pull origin master (원본 분기에서 마스터 분기로 이동).
  6. Rebase from Svn에서 모든 것을 동기화합니다. git svn rebase.

나는 이것을 시도하지는 않았지만, 꽤 일반적인 워크 플로이고, 얻는 오류는 두 개의 리모컨 (Svn 및 Github) 서비스와 관련이없는 것처럼 보입니다. 그들은 좀 더 일반적이고 워크 플로와 관련이 있으며 명령을 호출하는 방식입니다.

관련 문제