开发者

Is there a better way to recover git-svn branches?

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 removi开发者_StackOverflow社区ng the .git/svn directory and then git svn fetch caused a complete recovery.

But is there a better way ?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜