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

Posted by Ian Stevens on Stack Overflow See other posts from Stack Overflow or by Ian Stevens
Published on 2010-04-25T21:35:59Z Indexed on 2010/04/25 21:43 UTC
Read the original article Hit count: 321

Filed under:
|
|

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 those lost commits using git-svn dcommit on my local git repo? Is it sufficient to run git-svn dcommit with the SHA1 of the last recovered commit in SVN? eg.

> svn info http://tracked-svn/trunk | sed -n "s/Revision: //p"
252
> git log --grep="git-svn-id:.*@252" --format=oneline | cut -f1 -d" "
55bb5c9cbb5fe11a90ec2e9e1e0c7c502908cf9a
> git svn dcommit 55bb5c9cbb5fe11a90ec2e9e1e0c7c502908cf9a

Or will the git-svn-id need to be stripped from the intended commits?

I tried this using --dry-run but couldn't tell whether it would try to submit all commits:

> git svn dcommit --verbose --dry-run 55bb5c9cbb5fe11a90ec2e9e1e0c7c502908cf9a
Committing to http://tracked-svn/trunk ...
dcommitted on a detached HEAD because you gave a revision argument.
The rewritten commit is: 55bb5c9cbb5fe11a90ec2e9e1e0c7c502908cf9a

Thanks for your help.

© Stack Overflow or respective owner

Related posts about git

Related posts about svn