문제

I am one of the current maintainers of the FreeGLUT project on sourceforge. This code is stored in an SVN repo, but to stimulate contributions of others, I want to make a git repo available. I already have a git-svn clone of the svn trunk up on github currently at github (made through SmartGit, which is not really compatible with git-svn actually).

I made this by cloning https://svn.code.sf.net/p/freeglut/code/trunk/freeglut. However, I now find that I should have cloned https://svn.code.sf.net/p/freeglut/code and have SmartGit's svn bridge figure out the branches and trunk.

I have made this new correct clone locally. Now the problem: I already have a few commits in my local git repo of the old/wrong clone. I would like to transfer these over to my new repo, but as the root directories on disk are not the same, a simple rebase strategy as outlined here would not work (I think).

I could do it with patches, as git apply has the --directory argument to prefix the paths in the patch files that would make things work, but then I would have to do it commit by commit. At least, I have not found a way to put multiple commits in a single patch file (without squashing) and replay them all on top of my HEAD.

How to I best solve my problem?

도움이 되었습니까?

해결책

Ok, it turns out that:

  1. git format-patch can generate a file containing a range of commits, such as a whole branch.
  2. git am with the --directory option can replay the commits contained in the patch file one by one (see here) and commit them for me.

Problem solved!

다른 팁

Yes,you could do it with patches.

  1. Reset last commit by using git reset --soft 'HEAD^'. or if you have 3 commits. just do git reset --soft HEAD~3
  2. Do patches.

I think this answer explain it well.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top