Subgit says "leads to replacement of SVN branch"

[2022-03-25 12:51:34.139][pre-receive] Received '(warning (549:Failed to push some refs to Subversion 

The following ref update is disallowed:
  refs/heads/master: leads to replacement of SVN branch 'xxx'

If changes were forcefully pushed to Git repository, try to merge them with the upstream instead;
If changes were result of fast-forward merge, retry merge with --no-ff option.

You can allow branch replacements by adjusting SubGit configuration file as follows:
  'svn.allowBranchReplacement = true' in remote mirror mode;

So we have a branch where we are doing merges from the svn side. now a single commit is failing to sync from the git side with the message above. The new commit it in git does not need to be rebased, it has the most recent svn commit as its direct ancestor.

Why am I getting this error message? Are there any side effects if I set 'svn.allowBranchReplacement = true' as the error message suggests?


Hi Jonah,

the reason why this error appears is that a force push in a mirrored Git repository or a fast-forward merge from one branch into another cannot be translated to SVN in other way but the branch replacing, but it’s not a common practice in SVN and it’s thus disabled by default. Setting svn.allowBranchReplacement = true is the message as the message suggests:

  allowBranchReplacement = true

will allow such merges, but they will be translated as the whole branch replacement, that’s the main effect on SVN side.
Another possible way is to avoid the force pushes and always merge with no-ff creating a merge commit, so that this condition never appears.