SVN to git migration preserving branches Edited

I try to migrate out svn repo to the bitbucket.  My command history:

# git svn clone --authors-file=./authors.txt --trunk DBApp2/trunk --tags DBApp2/tags https://svn.server/reponame/ ad

# java -Dfile.encoding=utf-8 -jar ~/svn-migration-scripts.jar clean-git
# git branch -a

master
remotes/origin/BIN
remotes/origin/BIN@400
remotes/origin/ExListCtrl
remotes/origin/ExListCtrl@400


[....]

# git remote add origin http://mhobler@bitbucket.server:7990/scm/dat/ad.git

# git push -u origin --all
Password for 'http://mhobler@bitbucket.server:7990':
Counting objects: 91286, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (17631/17631), done.
Writing objects: 100% (91286/91286), 484.04 MiB | 34.09 MiB/s, done.
Total 91286 (delta 74607), reused 89339 (delta 72953)
remote: Resolving deltas: 100% (74607/74607), done.
To http://bitbucket.serverl:7990/scm/dat/ad.git
* [new branch] master -> master
Branch master set up to track remote branch master from origin.


 As you can see, there is only one branch pushed to server. The bitbucket web interface also shows only one branch (master). 

 

How can I push other branches to server?

1 answer

1 accepted

Check the .git/config file and see what has been added in there.

If you find the branches are still listed and svn remotes you will need to rename them to 'branches' to get the push to work correctly.

Thank you. Can you please be more specific?  What should I rename? How?

 

my .git/config looks like this:

[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[svn-remote "svn"]
url = https://svn.server/reponame
fetch = ad/trunk:refs/remotes/origin/trunk
branches = ad/qb*:refs/remotes/origin/*
branches = ad/QB*:refs/remotes/origin/*
branches = ad/devel*:refs/remotes/origin/*
branches = ad/Polaris/*:refs/remotes/origin/*
tags = ad/tags/*:refs/remotes/origin/tags/*
branches = ad/qb*:refs/remotes/origin/*
branches = ad/QB*:refs/remotes/origin/*
branches = ad/devel*:refs/remotes/origin/*
branches = ad/Polaris/*:refs/remotes/origin/*
tags = ad/tags/*:refs/remotes/origin/tags/*
[svn]
authorsfile = /home/marek/gitmigration/authors.txt
[remote "origin"]
url = http://mhobler@bitbucket.server:7990/scm/reponame/ad.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
[gitg]
mainline = refs/heads/master

I run the following sets of commands on a new copy to ensure they match up to git expectations.

 

cd ${repo_name}
sed '/svn-remote/a branches = ' .git/config > .git/newconfig
sed '/svn-remote/a tags = ' .git/newconfig > .git/config
#java -Dfile.encoding=utf-8 -jar /usr/local/cpa_bb/repos/svn-migration-scripts.jar clean-git --force
for branch in `git branch -r | sed 's/ origin\///'`; do echo $branch; git branch $branch remotes/origin/$branch; done
cd ..

Thank you so much, it fixed the issue here. 

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Piotr Plewa
Published Dec 27, 2017 in Bitbucket

Recipe: Deploying AWS Lambda functions with Bitbucket Pipelines

Bitbucket Pipelines helps me manage and automate a number of serverless deployments to AWS Lambda and this is how I do it. I'm building Node.js Lambda functions using node-lambda&nbsp...

1,773 views 1 5
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you