1

I am using a git svn mirroring system, more or less based on these blogs, and it works without any problem. Committing from a developers machine with git svn dcommit to the main repository and pulling from the git-svn mirror, all works without re-pulling any changes from either svn or git.

But, when pulling, I see strange things I have never seen from git:

$ git pull
From server:repository
 + 10cc435f163...953f9564671 trunk      -> origin/trunk  (forced update)
Already up to date.
$

Now first of all I didn't add a --force command line option, nor did anything change as far as I can see (git hashes of the commits etc).

What does happen here?

1 Answer 1

1

By default the fetch reference looks like:

[remote "origin"]
        url = ...
        fetch = +refs/heads/*:refs/remotes/origin/*

The "+" there is just means that remote-tracking references are always updated forced. This makes sense, because (I guess, you might reach out git authors for official position) they should not refer to any locally created code, and if there is some some local branch would refer to it.

Somebody has reset the remote trunk to a commit which is already merged to your local one, so there is nothing to merge. For example, it could be reset to a previous commit. You could check the difference between old and new remote trunks by a command:

git log --graph 10cc435f163...953f9564671
4
  • Thanks, that explains where the force is coming from, I forgot about the default fetch spec. I am still surprised to see that the remote trunk was reset. I can only imagine that git svn dcommit is doing some tricks. I will see whether I find the actual discrepancy. Thanks again. Commented Jun 5, 2018 at 6:06
  • You should definitely try to avoid forced pushes if you can, they are a symptom of something not working right. The occasional forced push when you detect something horribly wrong you absolutely must get rid of completely from the repository, that's maintainable, but not in your day-to-day development life. Commented Jun 5, 2018 at 6:08
  • No forced pushes here, only forced pulls into remote Commented Jun 5, 2018 at 9:43
  • @max630 Thanks, it is now clear what has happened. The difference is as you said that the remote head was not updated. The reason is that the git/svn fetching repo does the update only once every 15min, and if the pull happens before the fetching repo updates the git mirror, the local origin/trunk is reset, thus the forced update. Thanks a lot! Commented Jun 6, 2018 at 1:55

Not the answer you're looking for? Browse other questions tagged or ask your own question.