Say commit 666
is the one we need to skip. The trick is to make git
fetch all of the commits other than 666. Thankfully, git-svn gives us the -r
argument.
First, update to the commit immediately before the commit to be skipped:
git svn fetch -r BASE:665
Then, update everything after the bad commit to the Subversion tip:
git svn fetch -r 667:HEAD
That should give you a repository with everything except the commit you wish to skip. You can skip multiple revisions if necessary, just repeat the above commands for whatever range(s) of commits you do want to keep.
Skipping revisions can go awry if you skip file changes that will be affected by later revisions (e.g., you skip a file change or creation, and that file changes later in a revision you do fetch).
That said, I've just done it to skip a revision where someone had copied the entire Subversion repository into the tags/
directory, then deleted the obviously invalid tag. I used the above trick to skip the revision where the invalid tag was created (Git had been trying to download the entire repository), let it fetch the deletion (which it just ignored), and all was right with the world.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…