Discard unsynked commits

I have a git/svn server and i’d like to discard all the conflicted commits, how can i do that please?

Hello Angelo,

do I understand correctly you mean that you are using SubGit and some mirrored repository became unsynchronized so that there are different commits on SVN and Git sides? If so, do I get right you are willing to drop commits on Git side and synchronize the mirror taking the SVN history as the main line? If that is also true, then the best way to do it would be re-build the repository:

subgit install --rebuild <GIT REPO>

If the repository is too big, then it would be a good idea not to rebuild it from the very beginning but from a recent revision that is present both in Git and in SVN – that is, one of the know well synchronized revisions:

subgit install --rebuild-from-revision <REV_NO> <REPO PATH>

It will reset the repository state to the revision and re-translate the history after that revision.

Hello Ildar,

Yes that’s, correct, unfortunately doing a rebuild from revision would be too long, isn’t it possible to just delete the commits somehow ?

Best regards.


Hello Angelo,

basically, it’s possible to undo commits in a bare repository using Git commands, but taking into account that this is mirror, I would not recommend performing such changed this way and rather stick with the rebuild as the most safe approach for a mirrored repository. The whole rebuild would be long, indeed, but rebuilding from a revision would not as only small part of the repository to be rebuilt. Still, manual commits removing approach will take the same time anyway as all the absent SVN revisions should be translated in Git to restore the mirror. In fact, rebuild from revision will do exactly same think – it will reset the repository state moving conflicting commits to a different not-mirrored Git namespace and then import absent SVN revisions. The crucial thing here is to set the repository to be rebuilt from the very recent synchronized revision.


The problem is the the firs of the unsynked revision dates to 6 months ago and we have several undred commits per day, I made a copy of the repo and run the conmand this morning and it’s still running, any advice on hot to fix that ?

Best Regards,


Hello Angelo,

6 months of revisions will definitely require some time to import, indeed, but the thing is that it’s essential, all those revisions should be imported anyway. The speed of the import may vary depending on the revisions number, settings, and what exactly was done in those commits. It’s hard to tell for sure not knowing all this things if the speed is proper or too slow; there are some considerations about the import, here is an article that describes them:

TMate SubGit: Frequently asked questions

Yet note, that most of those settings should be done prior the import start, so if it already running it may be a better solution to keep it working if it’s somewhere near to the end. It’s possible to check the logs to (in the repository or in .subgit directory in user’s home) to find out the currently translating revisions.