{"thread":{"id":"23605","subject":"Can I recover lost commits in a SVN repository using a local tracking git-svn branch?","startedAt":"2010-04-26T14:09:55Z","lastAt":"2010-04-26T15:21:00Z","messageCount":2,"participants":["Ian Stevens"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"140416","messageId":"904c3ddb-a565-4514-9f5e-83b3706b9fec@t36g2000yqt.googlegroups.com","threadId":"23605","inReplyTo":null,"subject":"Can I recover lost commits in a SVN repository using a local tracking git-svn branch?","fromName":"Ian Stevens","fromEmail":"iancstevens@gmail.com","sentAt":"2010-04-26T14:09:55Z","receivedAt":"2010-04-26T14:09:55Z","isPatch":false,"sender":{"key":"iancstevens@gmail.com","avatar":null},"body":"A SVN repo I use git-svn to track was recently corrupted and a backup\nwas recovered. However, a week's worth of commits were lost in the\nrecovery. Is it possible to recover those lost commits using git-svn\ndcommit on my local git repo? Is it sufficient to run git-svn dcommit\nwith the SHA1 of the last recovered commit in SVN? eg.\n\n    > svn info http://tracked-svn/trunk | sed -n \"s/Revision: //p\"\n    252\n    > git log --grep=\"git-svn-id:.*@252\" --format=oneline | cut -f1 -\nd\" \"\n    55bb5c9cbb5fe11a90ec2e9e1e0c7c502908cf9a\n    > git svn dcommit 55bb5c9cbb5fe11a90ec2e9e1e0c7c502908cf9a\n    Or will the git-svn-id need to be stripped from the intended\ncommits?\n\nI tried this using --dry-run but couldn't tell whether it would try to\nsubmit all commits:\n\n    > git svn dcommit --verbose --dry-run\n55bb5c9cbb5fe11a90ec2e9e1e0c7c502908cf9a\n    Committing to http://tracked-svn/trunk ...\n    dcommitted on a detached HEAD because you gave a revision\nargument.\n    The rewritten commit is: 55bb5c9cbb5fe11a90ec2e9e1e0c7c502908cf9a\n\nI also tried a naive git-svn dcommit but receive this error (r285 is\nthe old SVN HEAD which was lost):\n\n    > git svn dcommit\n    Committing to http://tracked-svn/trunk ...\n    Invalid filesystem revision number: No such revision 285 at /opt/\nlocal/libexec/git-core/git-svn line 4346\n\nThanks for your help,\nIan.\n"},{"id":"140420","messageId":"f01c5562-3cb1-4307-a5ab-f51e5157eba9@c21g2000yqk.googlegroups.com","threadId":"23605","inReplyTo":"904c3ddb-a565-4514-9f5e-83b3706b9fec@t36g2000yqt.googlegroups.com","subject":"Re: Can I recover lost commits in a SVN repository using a local tracking git-svn branch?","fromName":"Ian Stevens","fromEmail":"iancstevens@gmail.com","sentAt":"2010-04-26T15:21:00Z","receivedAt":"2010-04-26T15:21:00Z","isPatch":false,"sender":{"key":"iancstevens@gmail.com","avatar":null},"body":"Here is how I achieved what I wanted:\n\n1. Re-cloned http://tracked-svn/trunk in a fresh git-svn repo.\n2. Added my old git-svn repo as a remote to the fresh repo. (eg. git\nremote add -f up-to-date /path/to/repo)\n3. git merge remotes/up-to-date/master\n4. git svn dcommit\n\nRebasing on my old repo gives no errors, and dcommit works as\nexpected.\n\nThis might not be the best way to recover commits, but it got me what\nI wanted.\n\nIan.\n"}]}