I use git-svn to keep a clone of a shared Subversion repository. Recently someone edited the commit message of a revision (a la this SO question) after I had git svn fetch
ed that revision. How can I correct my Git clone to have the correct commit message?
I had expected git svn reset
followed by git svn fetch
to refetch this commit and update things, leaving me to only need to fix up my local branches, but that doesn't actually seem to do anything; the git svn fetch
doesn't refetch the commits I reset to.
(Yes I think changing the commit message was a bad idea, but that's not something I have control over.)
Update: I tried the process that sleske suggested (in fact, I'd tried it before asking the question, but I just tried again just in case), but with no luck. I get output like the below:
me_and@centos ~/code ((358a2dd...)) Fri 16 Jan 15:31:27
$ git svn reset -p 55102
r55094 = 25d126219f7eeddfc7d0842704c7efcc0443dd70 (refs/remotes/origin/branchname)
me_and@centos ~/code ((358a2dd...)) Fri 16 Jan 15:33:06
$ git svn fetch
me_and@centos ~/code ((358a2dd...)) Fri 16 Jan 15:33:08
$
There's no output from git svn fetch
(or there is if there has been commits since I last ran it, but it's just fetching the new commits, not refetching the old ones), and in particular there's no rereading
message as in sleske's example.
In case it's relevant, I'm using Git v2.0.4.
Update 2: Slightly redacted .git/config
below:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[svn-remote "svn"]
url = http://server/repos/repo
fetch = trunk:refs/remotes/origin/trunk
branches = branches/*:refs/remotes/origin/*
tags = tags/v10/*:refs/remotes/origin/tags/*
tags = tags/v11/*:refs/remotes/origin/tags/*
tags = tags/v12/*:refs/remotes/origin/tags/*
tags = tags/v13/*:refs/remotes/origin/tags/*
I'll not post the full output of git branch -avv
, because there's a lot of it, but that's where it gets really interesting, so I'll post a list of everything I did:
I had a checkout of a branch other than the branch with the error. Running
git svn reset
made no difference:remotes/origin/branchname
continued to point at a more recent commit. Unsurprisingly,git svn fetch
did nothing.I checked out
remotes/origin/branchname
and rangit svn reset
again. This worked:remotes/origin/branchname
pointed at the parent of the duff commit.I ran
git svn fetch
. This did absolutely nothing: no commits were fetched andremotes/origin/branchname
didn't move.I created a couple of dummy commits on that branch in the Subversion repository (one added an empty file, the next deleted it again), then ran
git svn fetch again
.Here's where it gets really odd: the duff commit wasn't refetched. Instead, the fetch started at the commit where I added the dummy file, reported an "Index mismatch" in the process.Running
git show
on the commit that added the dummy file shows it with all the diffs between the commit I reset to and the dummy commit.Now, running
git log --graph --decorate --pretty=oneline --abbrev-commit HEAD origin/branchname
looks like this:* 7b12bbc (origin/branchname) Remove dummy file * 730c2ab Add dummy file # But `git show 730c2ab` includes the diffs between b89af06 and 93920f9 as well | * 93920f9 (HEAD) Uninteresting commit | * 91c7163 Uninteresting commit | * ce51022 Commit with the changed commit message |/ * b89af06 Uninteresting commit
Note that, other than
HEAD
, there is now nothing pointing to some of the commits on this branch.
I'm rapidly coming to the conclusion that at least some of this behaviour is simply a bug in git svn
. Certainly what I saw in point 4 above is not something that should happen at all, at least by my understanding.
git branch -avv
before and after the invocation ofgit svn reset ...
. The latter should show what happens to the remote-tracking branch used bygit svn
. – Bide.git/config
as requested, and done a bit of digging based on the output ofgit branch -avv
. It's very odd. – Giessergit svn
. I'm afraid that in order to get more help, you'll have to provide a reproducible test case. You could try whipping up a script that creates a local SVN repo , then checks it out viagit svn
. If you use the same repo layout and options, and create structurally similar commits, maybe you can reproduce the problem. – Bide