Вопрос

Basically, I would like to revert a central SVN repository back to a previous commit, kinda like this:

svn update
svn merge -r 150:140 .
svn commit -m "Rolled back to r140"

But I'm using git-svn and cannot seem to find an equivalent.

I've tried setting everything up locally on a new branch by checking out an earlier commit that was an ancestor of trunk (the current commit of the central repo). I made a few additional changes and now I cannot git svn rebase or git svn dcommit without getting an error from SVN.

I tried checking out that same commit without making the additional changes and then running git svn dcommit, this says it is committing to the central repo but doesn't actually seem to do anything.

How do I go back to a previous commit and then start making new changes?

Это было полезно?

Решение

Your task is essentially to reset your git HEAD into the state of r140, but in a way that would allow a straightforward git svn dcommit.

One way of doing this:

# checkout git revision of the desired state
git svn find-rev r140 | xargs git checkout

# reset HEAD to the revision 150, assuming it was the latest svn commit in trunk 
git reset trunk
git add -u
git commit -m "Rolled back to r140"
git svn dcommit

You could also take a look on thread Revert multiple git commits

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top