Micha Wiedenmann Micha Wiedenmann -3 years ago 144
Git Question

How to repair git-svn history when the commit message of a svn commit changes?

I use

to connect to a subversion server. It seems to be possible to change the subversion commit message (of an old commit). See the accepted answers here or here. However
git svn rebase
does not notice such change.

How can I tell
git svn
to "repair" such changes in its history?

At first I did not notice that my history was broken by still containing the old commit message until I added a remote. This remote is another
checkout of the same server. When one of the two checkouts updates (using
git svn rebase
) before the commit message in svn is changed and the other updates after the change, then the
branch will point to different SHA-1 hashes in my repository and the remotes repository. That is one of the
branch pointer is wrong and needs to be resynchronized/repaired:

/ C - D - E - F
.... - A - B
\ C' - D' - E' - F'
later changed

Answer Source

Use git svn reset -r <n> to reset (where <n> is a Subversion revision; see doc):


Undoes the effects of fetch back to the specified revision. This allows you to re-fetch an SVN revision. [...] Follow reset with a fetch and then git reset or git rebase to move local branches onto the new tree.


$ git svn find-rev B
$ git svn reset -r3
r3 = 6f29012a3e25e00c899976b584084d6968aba43d (refs/remotes/git-svn)
$ git svn fetch
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download