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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jun 12, 2018 in Bitbucket

Do you use any Atlassian products for your personal projects?

After spinning my wheels trying to get organized enough to write a book for National Novel Writing Month (NaNoWriMo) I took my affinity for Atlassian products from my work life and decided to tr...

27,844 views 26 12
Join discussion

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