MaxNoe
MaxNoe

Reputation: 14997

Restoring a lost svn history for a git project

I have a project, that was migrated from SVN to git some time ago.

WELL. Not really migrated. The last SVN revision was copied into the initial git commit. So basically all SVN history was squashed into the first git commit.

Many commits have now been added to the git repository.

Is there a way to way to rebase the new git commits onto a properly converted git repo? So we have the full history again?

Edit:

I now have two git branches, one with all the old history (old), another with all the new history (new). There is no diff between the last commit of old and the first commit of new. How do I merge those histories into one?

Upvotes: 1

Views: 176

Answers (1)

eftshift0
eftshift0

Reputation: 30212

With a little work, sure. First, migrate correctly the svn repo into a git repo. Then add the git repo that you created from svn before (bad-remote, from now on) as a remote. When you fetch from it, you will be able to see the remote branches from bad-remote. Then rebase (or cherry-pick, whavever you think will be fine) the work that you did on bad-remote on top of the new svn branches on this repo.

git rebase --onto svn-full-history svn-short-history-first-revision-id svn-short-with-git-only-commits

That should apply all the git-only changes onto the full svn branch.

Upvotes: 1

Related Questions