Search code examples
gitgit-pull

git pull automatic forced updated without changes


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?


Solution

  • 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