开发者

How can I combine my separate repo as if it started off as a fork?

I have these two github repos, on both of which I'm an admin:

  • https://github.com/ripper234/osqa
  • https://github.com/sghael/OSQA

Both were created using git-svn from ... an svn repository, of course. Now, I would like to merge the two repos into one coherent view (please excuse if my terminology isn't exact). I would like to have one repo (https://github.com/sghael/OSQA), with a few branches:

  • master - this one is auto-synched with svn and doesn't receive any native git commits. (We already have this auto-synch in place by a cron job that does git svn rebase)
  • "other master" (let's call it osqaplus) - We will do our integration work on this branch, and every now and then we'll merge new content from master.
  • Any number of development/feature branches, to be branched off osqaplus.

Now, what I'd like to do is take the changes from my own repository (ripper234) and add them to sghael's repository as if I originally forked from him. I imagine that this will be accomplished by creating a new fork开发者_如何学Python, and merging my changes there, but I'm much too new to git to try to accomplish this on my own. Also, when I view sghael's project and hit "fork", I am simply taken to my own repository, and no actual fork is created. Do I have to rename my existing repo for this to work?


I understand that you want sghael/OSQA to be a fork of ripper234/osqa. If this is the case, then you should rename sghael/OSQA (for example sghael/OSQA_renamed) and create a fresh fork from ripper234/osqa.

Then the only thing missing is pushing the changes you want from sghael/OSQA_renamed to ripper234/osqa. One way to do this is adding the changes to your fresh fork (sghael/OSQA) and creating pull requests, or pushing directly to ripper234/osqa by adding it as a remote to your sghael/OSQA_renamed repository.


if both repositories were created using the same options with git-svn, then the commits will be identical, and both repository should already be forks (in the git sense)

to see if this is the case, you can do the following:

git clone …/OSQA # this will clone the repo and create a remote named 'origin'
git remote add ripper …/osqa
git fetch
gitk --all # you should see all branches, check the svn-history is in fact the same between origin and ripper remotes
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜