Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I clean up completely after SVN -> Git migration?

Tags:

git

git-svn

I've migrated a repo from SVN to Git using svn2git and am happy with everything apart from one thing. How can I remove the remotes/svn/trunk branch that shows in git branch -a:

$ git branch -a
* master
  remotes/origin/master
  remotes/svn/trunk

I cleaned up after svn2git by doing the following:

git config --remove-section svn-remote.svn
git config --remove-section svn
rm -rf .git/svn

But I still have the remotes/svn/trunk sitting there! I get this if I grep the .git directory for svn:

$ grep -R svn .git
.git/info/refs:e6dd7a08d86d9b0944891755602b25ce12d30bb0 refs/remotes/svn/trunk
Binary file .git/objects/pack/pack-10cdd522d8f0fcc9b30efeddbdad3d0281c1e6da.pack matches
.git/packed-refs:e6dd7a08d86d9b0944891755602b25ce12d30bb0 refs/remotes/svn/trunk

Am I safe to go into those files and remove the references or is there a cleaner way to get rid of that old cruft?

like image 727
mattjgalloway Avatar asked Jul 15 '12 11:07

mattjgalloway


People also ask

Which migration is actually recommended for migration from SVN to Git?

When moving to Git from another version control system like Subversion (SVN), we generally recommend that you perform a "tip migration", which migrates just the latest version of the repository contents, without including history.


1 Answers

Deleting the remote tracking branch would be a good start:

git branch -d -r svn/trunk

Other advices are available at "How do you stop tracking a remote branch in git?".
But to really clean, you may have to do other operations (based on git gc for instance) as mentioned in "How to remove unreferenced blobs from my git repo".

like image 187
VonC Avatar answered Sep 21 '22 18:09

VonC