blackbird
blackbird

Reputation: 1137

Git svn rebase results in conflicts

I ran a git filter-branch on a rather large repo (~8000 commits) to remove certain binaries, but now when I do git svn rebase to keep my repo up to date, it results in a huge list of conflicts. I'm guessing it's because both commands involve rewriting the history.

Is there any way I can sync to Git from SVN after my filter-branch without these conflicts ? Will any future rebase also result in such problems too ? (I'm only syncing one way from SVN to Git)

Upvotes: 0

Views: 131

Answers (2)

Alex Wolf
Alex Wolf

Reputation: 20128

As I see it there is nothing you can do to make filter-branch and svn rebase compatible. You're rewriting history which has a relationship to a remote. As such you change the commit hashes and make the mapping of the SVN rev_map utterly useless.

It would be a different story if you removed the remote after filter-branch, in that case it simply wouldn't matter, but as it stands I see no way to make this work.

Upvotes: 1

Andreas Duering
Andreas Duering

Reputation: 1758

Commits which have been sent to SVN (via git svn dcommit) should not be further altered, as it results in conflicts as you saw.

In a git-only scenario, you could theoretically do a git push --force (although it's not encouraged if you work with others via that repo), but SVN doesn't allow that.

So, you cannot rewrite what's already been sent to the subversion server. If the binaries are on the subversion server, filter-branch wouldn't help you anyway. ALSO, if you use SVN tools on the server itself to remove the binaries, you would need a fresh checkout of the git copy - the git-svn data would be invalid at that point.

Only thing you can do now is reset your master branch to origin/trunk.

edit: As for the emerging conflicts, my guess would be that the filter-branch messes up the relationships between git commits and svn revision numbers in $GIT_DIR/svn/**/.rev_map.* (see git-scm.com/docs/git-svn: CAVEATS/FILES). Also, conflicts would naturally occur if there were changes from SVN side on files you deleted in your git copy.

Upvotes: 1

Related Questions