Can I recover lost commits in a SVN repository using a local tracking git-svn branch?

后端 未结 3 1317
故里飘歌
故里飘歌 2020-12-19 17:25

A SVN repo I use git-svn to track was recently corrupted and a backup was recovered. However, a week\'s worth of commits were lost in the recovery. Is it possible to recover

3条回答
  •  抹茶落季
    2020-12-19 17:47

    I found this article that shed some light on the detached_head situation.

    I've been dealing with more or less the same issue here and this is what I ended up doing:

    • First, always make sure you're on a valid branch git branch
    • If you see (no branch) (w/asterisk indicating "current branch"), that means you have a detached head
    • Checkout the detached head git co -b [BRANCH NAME] --track. Using the --track option, I THINK makes it track the git-svn HEAD and therefore reattachs this new branch to a HEAD.
    • Continue with git svn rebase/dcommit commands per usual.

    This is probably bad, but this also seemed to help - I deleted the master branch and then after doing a git svn rebase, it seems to add back in the master branch automatically.

    Also, I viewed the logs of a file and it seems that once I did a git svn dcommit, all the git checkins were intact from when my branch started going crazy and I was trying to do whatever I could to get it set back correctly.

    I'm not 100% sure this is completely correct, but I this seemed to work for me.

提交回复
热议问题