git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
ISIan Stevens <iancstevens@gmail.com>
Date
Apr 26, 2010, 14:09 UTC
Message-ID
<904c3ddb-a565-4514-9f5e-83b3706b9fec@t36g2000yqt.googlegroups.com>

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

I also tried a naive git-svn dcommit but receive this error (r285 is the old SVN HEAD which was lost):

    > git svn dcommit
    Committing to http://tracked-svn/trunk ...
    Invalid filesystem revision number: No such revision 285 at /opt/
local/libexec/git-core/git-svn line 4346

Thanks for your help, Ian.

Next: Ian Stevens
Message 1 of 2 in “Can I recover lost commits in a SVN repository using a local tracking git-svn branch?”
  1. Ian StevensApr 26, 2010
  2. Ian StevensApr 26, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.