2

After cloning my SVN repo into GIT, I deleted in my GIT repository the SVN branches that I was not likely to use as I had not read of how to just load a specific branch.

Now I need them all back but could not easily recover them (One at a time would be a bit slow). git svn fetch did not work for me as the trunk was up to date and the branches haven't change in a long time (even with changing around the git svn config) But moving or removing the .git/svn directory and then git svn fetch caused a complete recovery.

But is there a better way ?

1 Answers1

0

You method seems the most straightforward.

The other way is to list all the dangling commits which could represent the tip of the delete branches (that is, if you haven't deleted them too long ago, since by default they would be pruned from your repo after 30 days.
See "Listing and deleting Git commits that are under no branch (dangling?)" and "In Git, how do you see and manage commits that aren't in a branch?" to see the git reflogs and git fsck in action for this.

git fsck --unreachable --no-reflogs

But that would be practical in your case, as you would need to "guess" to which remote branch that dangling tip corresponds to.

Community
  • 1
  • 1
VonC
  • 1,042,979
  • 435
  • 3,649
  • 4,283