This is old Git behaviour, that has been fixed in recent Git releases. Anything more recent than Git 1.7.12 will no longer automatically recreate a master branch. You can run git --version
to get the version of Git you're currently running.
That's not much use if the version that comes with your operating system is earlier than 1.7.12 (the latest I have easy access to, between my Debian, RHEL and Cygwin systems, is 1.7.9).
If you want to, you should be able to make the change yourself, however. Find the copy of git-svn
or git-svn.perl
on your system (on mine, it's /usr/lib/git-core/git-svn
), then make the following changes:
Below
Git::SVN::init_vars()
, move thepost_fetch_checkout();
line to before the closing brace, so that bit of code looks like so:Git::SVN::init_vars(); eval { Git::SVN::verify_remotes_sanity(); $cmd{$cmd}->[0]->(@ARGV); post_fetch_checkout(); }; fatal $@ if $@; exit 0;
In the
post_fetch_checkout
subroutine…Add the following line above the line starting
my $gs =
:return if verify_ref('HEAD^0');
Delete the line that reads like so:
return if verify_ref('refs/heads/master^0')
Replace the following lines:
my $valid_head = verify_ref('HEAD^0'); command_noisy(qw(update-ref refs/heads/master), $gs->refname); return if ($valid_head || !verify_ref('HEAD^0'));
with the following:
command_noisy(qw(update-ref HEAD), $gs->refname); return unless verify_ref('HEAD^0);
The above changes will apply the patch that changed this behaviour in the Git source code. You can see that for yourself: the relevant commit is v1.7.11.2-250-ge3bd4dd by Marcin Owsiany.