1

I need to revert multiple revisions (e.g. 28693, 28756, 28747) which are already in svn repo.

With svn I can achieve this with one command:

svn merge -c -28693,-28756,-28747 https://repository/trunk

How to make the same with git-svn?

Kamil Dziedzic
  • 4,721
  • 2
  • 31
  • 47

1 Answers1

2

git revert <commit1> <commit2> ... should do the trick.

Edit following the discussion:
If you don't know the hashes (you can find the SVN revisions in the git log by looking at the git-svn-id field, it's the number after the @), the following one-liner works for me:

git revert $(echo r<REV1> r<REV2> r<REV3> | xargs -n1 git svn find-rev)
Michael Wild
  • 24,977
  • 3
  • 43
  • 43
  • This will revert range of commits (28693-28747), not cherry-picked revisions (28693, 28756, 28747). – Kamil Dziedzic Feb 06 '13 at 13:09
  • Also, you've omitted the step where you need to figure out which `git` commits correspond to the desired revisions. I'm unaware of a simpler way to do that than manually scanning commit messages for `git-svn-id`s that contain the revision numbers. – chepner Feb 06 '13 at 13:16
  • Yeah, I know. I just didn't wanted to ask to many questions at once:) Answer for any of them would be big step forward. If none will be possible then, well some shell script will do the thing. – Kamil Dziedzic Feb 06 '13 at 13:21
  • Sorry, misread the question. specifying the commits individually such as `git revert ` also works. The problem of mapping SVN revision numbers to commit hashes remains, though. – Michael Wild Feb 06 '13 at 14:04
  • 2
    @chepner: On finding a Git hash from a Subversion revision number: http://stackoverflow.com/q/2989825/220155 – me_and Feb 06 '13 at 16:50