Bug #4771
closedunable to update local ref after git forced update
0%
Description
Got this error in git pull of any git clone of myami trunk pre-existing before 02/09/2017
From http://emg.nysbc.org/git/myami + e2029c8...e48a4bc HEAD -> origin/HEAD (forced update) 6003223..d9c822b myami-beta -> origin/myami-beta error: Ref refs/remotes/origin/trunk is at e48a4bc1ea51b705af53fe11b778aff350f58f88 but expected e2029c8564925c5e9dbe34dab51fb920899810ab ! e2029c8..e3c1609 trunk -> origin/trunk (unable to update local ref)
myamiweb/runStat.php is therefore not updated to that of fe38d5f4
myamiweb/processing/inc/menuprocessing is not updated to that of a84f6873
Updated by Anchi Cheng almost 8 years ago
Still having the problem even though I made a new clone. Every pull becomes a forced update.
Found some info about it https://www.borfast.com/blog/2014/10/19/how-to-undo-a-git-push---force-and-undelete-things/
98d15ba is where I cloned by
git clone -b trunk http://anchi@emg.nysbc.org/git/myami
[acheng@emganchi dbschema]$ git reflog show remotes/origin/trunk e48a4bc remotes/origin/trunk@{0}: pull : forced-update 5a14f0b remotes/origin/trunk@{1}: pull : forced-update e48a4bc remotes/origin/trunk@{2}: pull : forced-update 5a14f0b remotes/origin/trunk@{3}: fetch: forced-update e48a4bc remotes/origin/trunk@{4}: pull : forced-update 5a14f0b remotes/origin/trunk@{5}: pull : forced-update e48a4bc remotes/origin/trunk@{6}: pull : forced-update 5a14f0b remotes/origin/trunk@{7}: update by push a5d6c7f remotes/origin/trunk@{8}: update by push e48a4bc remotes/origin/trunk@{9}: pull : forced-update 98d15ba
Updated by Anchi Cheng almost 8 years ago
I wonder if it is a bug for older git. I have no problem on my Mac which has 2.5.4.
Updated by Sargis Dallakyan almost 8 years ago
- Related to Support #4136: Switch from svn to git added
Updated by Sargis Dallakyan almost 8 years ago
- Status changed from Assigned to Closed
Thanks for the updates and the link Anchi; interesting read. It seem a bit daunting and I also learned the difference between log and reflog today at http://stackoverflow.com/questions/17857723/whats-the-difference-between-git-reflog-and-log
To fix this in your local repository run:
$ git gc --prune=now $ git remote prune origin
Source: http://stackoverflow.com/questions/2998832/git-pull-fails-unable-to-resolve-reference-unable-to-update-local-ref
I checked at our production at server at NYSBC (node02) and it is not affected by this. I'll try to avoid doing force updates moving forward.