wesley tanaka

Un-fetch git-svn revisions; Rewind git svn commits; Revert remotes/trunk branch

‹ Great Timing | Seeing the world through a kid's eyes ›

It's possible for an old subversion commit to be changed after it has already been committed.  One example is someone editing a commit log message for an old revision with svn propedit -r <revision> --revprop svn:log <URL>

If you already have the affected revision in your git-svn repository clone, running git svn fetch and git svn rebase will not update the old revision. To re-fetch a revision you already have, follow these steps (which assume that the revision is on the remotes/trunk branch)

  1. Make sure you are in the root of your git-svn checkout (ls -d .git/svn should print .git/svn)
  2. Backup your .git directory with something like:
    tar cvf - .git | gzip -9 -c > dot-git-backup.tar.gz
    cp -a .git dot-git-backup
  3. rm .git/svn/refs/remotes/trunk/.rev_map.*
  4. git pack-refs --all
  5. Edit .git/packed-refs and change the commit hash next to refs/remotes/trunk to the commit before the one you want to re-fetch
  6. git svn fetch
Syndicate content
by Wesley Tanaka