[英]Tracking upstream svn changes with git-svn and github?
How do I track upstream SVN changes using git-svn and github? 如何使用git-svn和github跟踪上游SVN更改?
I used git-svn to convert an SVN repo to git on github: 我使用git-svn将SVN repo转换为github上的git:
$ git svn clone -s http://svn.osqa.net/svnroot/osqa/ osqa
$ cd osqa
$ git remote add origin git@github.com:turian/osqa.git
$ git push origin master
I then made a few changes in my git repo, committed, and pushed to github. 然后我在我的git repo中进行了一些更改,提交并推送到github。
Now, I am on a new machine. 现在,我在一台新机器上。 I want to take upstream SVN changes, merge them with my github repo, and push them to my github repo.
我想进行上游SVN更改,将它们与我的github repo合并,然后将它们推送到我的github repo。 This documentation says: "If you ever lose your local copy, just run the import again with the same settings, and you'll get another working directory with all the necessary SVN metainfo."
该文档说:“如果您丢失了本地副本,只需使用相同的设置再次运行导入,您将获得另一个包含所有必需SVN元信息的工作目录。”
So I did the following. 所以我做了以下几点。 But none of the commands work as desired.
但是没有一个命令按预期工作。 How do I track upstream SVN changes using git-svn and github?
如何使用git-svn和github跟踪上游SVN更改? What am I doing wrong?
我究竟做错了什么?
$ git svn clone -s http://svn.osqa.net/svnroot/osqa/ osqa
$ cd osqa
$ git remote add origin git@github.com:turian/osqa.git
$ git push origin master
To git@github.com:turian/osqa.git
! [rejected] master -> master (non-fast forward)
error: failed to push some refs to 'git@github.com: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 git@github.com:turian/osqa
* [new branch] master -> origin/master
From git@github.com: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
It looks like, with the exception of your rebase, everything happened as expected, but with a lot more verbiage that you might expect. 看起来,除了你的rebase之外,一切都按预期发生,但你可能会有更多的措辞。 Here's what I think I would do to create/integrate the bits on a new machine:
以下是我想在新机器上创建/集成位的方法:
--prefix=svn/
when cloning so that all of my remote branches from Svn are annotated as such. --prefix=svn/
,这样我从Svn的所有远程分支都会被注释。 git co -b local-branch svn/branchname
. git co -b local-branch svn/branchname
。 Now you have a nice, local area for playing with stuff. git pull origin master
(pull from origin to the master branch). git pull origin master
(从原点拉到master分支)。 git svn rebase
. git svn rebase
。 I haven't tried this, but it's a pretty typical workflow and the errors you're getting don't seem to be related to your service of two remotes (Svn and Github). 我没有试过这个,但这是一个非常典型的工作流程,你得到的错误似乎与你的两个遥控器(Svn和Github)的服务无关。 They appear to be a bit more generic and related to your workflow and how you're calling the commands.
它们看起来更通用,与您的工作流程以及您如何调用命令有关。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.