-1

I've got a SVN repo I'm converting to git (I'm being dragged, kicking and screaming, into the 21st Century...!)

I'm following the instructions at https://john.albin.net/git/convert-subversion-to-git, but realise they're pretty old, and I don't know how much git has changed recently.

The instruction in Section 5 is

git branch -m trunk master

but I only have origin/trunk, so running this command returns

$ git branch -m trunk master
error: refname refs/heads/trunk not found
fatal: Branch rename failed

Has git changed how it refers to the master branch since these instructions were written?

I'm also trying to work out if I actually need to do step 4? Can I push the result of Step 3 straight into a new github repo that I've created?


more info

In fact, all of my branches (apart from master) are prepended with origin:

svn2gitdir $ git branch -a
* master
  origin/add-pictures
  origin/fix-forms

From what I understand about git, this means it thinks they're remote?

If I set up a brand new local blank git repo, and add a branch, then they are truly local:

gittestdir$ git branch -a
  master
* mnb

I've used the following command to convert svn branches to git branches:

 for b in $(git for-each-ref --format='%(refname:short)' refs/remotes); do git branch $b refs/remotes/$b && git branch -D -r $b; done

Is this a problem? What does it mean?

ChrisW
  • 4,970
  • 7
  • 55
  • 92
  • Just use SubGit instead of this mammoth's bullhiit – Lazy Badger Sep 22 '19 at 16:50
  • @LazyBadger I'm trying to understand git, and SubGit doesn't seem to explain what it's doing – ChrisW Sep 22 '19 at 19:46
  • I would recommend Bitbucket's comprehensive and up-to-date [Migrating to Git](https://www.atlassian.com/git/tutorials/svn-to-git-prepping-your-team-migration) instead. – Schwern Sep 22 '19 at 20:28
  • For the person who voted this down, I'd appreciate some feedback on how you think I'd improve it. – ChrisW Sep 23 '19 at 11:25

1 Answers1

1

The error means that you don't have a local branch named "trunk". if you execute the command git branch --all, you will see all local and remote branches. if you've pushed master already, you can checkout local branch under whatever name you wish with the command git checkout -b local_branch_name remote_branch_name

  • I think I've realised that `git svn` now makes the main branch name master by default, perhaps it didn't before - but I've also updated my question with some more info – ChrisW Sep 22 '19 at 20:21