Hi Phil, On 22 June 2012 11:34, Phil Hord <phil.hord@xxxxxxxxx> wrote: > On Fri, Jun 22, 2012 at 1:53 PM, Hilco Wijbenga > <hilco.wijbenga@xxxxxxxxx> wrote: >> One of my developers managed to push something that somehow "diverged" >> origin/master from everyone else's local master. >> >> A --> B --> C --> D (everybody's local master) >> | >> \--> B' --> C' --> D' --> E (origin/master) >> >> (i.e., A is the commit where things diverged; everyone's local master >> points to D but the new commit (E) that was pushed to origin/master >> uses different SHA1s for B, C, and D). I hope I explained it clearly >> enough. >> >> Now running git pull creates a merge commit joining D and E. >> >> When I asked the developer what he had done he told me everything had >> looked normal. No Git warnings, nothing strange in gitk (i.e. normal >> linear history). So I do not understand what went wrong. >> >> Does anyone have any idea as to what might have happened? Perhaps if I >> understand how this happened I might be able to prevent it from >> happening again. > > There are a number of ways this can happen, but they all involve > rewriting history. Usually that is something your developer would be > aware of doing. It does not usually happen by mistake. My thoughts exactly. > Also, in order to push the new E commit, the developer would have to > "force" the push by placing a "+" in front of the references, like > this: > > git push origin +master:master Is that the same as git push --force origin master ? > If he used a gui, then I do not know how this option would be spelled, > but it may be called "force" or something else. AFAIK, he uses the CL for this. No GUI. > You can look at the reflog on the developer's machine to determine > where the new commits came from. For example, here are some commits I > rebased a few weeks ago in a repository on my machine: > > $ git reflog --relative-date > c93b31b HEAD@{6 weeks ago}: checkout: moving from mine to c93b31b > 93a357f HEAD@{6 weeks ago}: rebase finished: returning to refs/heads/mine > 93a357f HEAD@{6 weeks ago}: rebase: Add a makefile to help me remember > how to make > f804993 HEAD@{6 weeks ago}: rebase: Allow working in multiple branches > c93b31b HEAD@{6 weeks ago}: rebase: Update Gerrit 2.4 ReleaseNotes > 5cac09e HEAD@{6 weeks ago}: rebase: Gerrit 2.4 ReleaseNotes > f41a9b4 HEAD@{6 weeks ago}: checkout: moving from mine to > f41a9b447304733a1784ece373723f8622c8dbad^0 > 879e5d9 HEAD@{6 weeks ago}: rebase finished: returning to refs/heads/mine > 879e5d9 HEAD@{6 weeks ago}: rebase: Add a makefile to help me remember > how to make > 35d7a48 HEAD@{6 weeks ago}: rebase: Allow working in multiple branches > c7a845a HEAD@{6 weeks ago}: rebase: Update Gerrit 2.4 ReleaseNotes > 7b51315 HEAD@{6 weeks ago}: rebase: Gerrit 2.4 ReleaseNotes > d6799b1 HEAD@{6 weeks ago}: checkout: moving from mine to > d6799b1d40ffc5412e4174fd95bd5fb412781537^0 > d9bb39b HEAD@{6 weeks ago}: checkout: moving from > d6799b1d40ffc5412e4174fd95bd5fb412781537 to mine > d6799b1 HEAD@{6 weeks ago}: checkout: moving from mine to origin/master > d9bb39b HEAD@{6 weeks ago}: commit (amend): Add a makefile to help me > remember how to make > 62097f8 HEAD@{6 weeks ago}: commit: Add a makefile to help me remember > how to make > dfa61e4 HEAD@{6 weeks ago}: checkout: moving from > dfa61e465bcb27f5698c48d1ec9d32e8fd62c604 to mine bb91ffa HEAD@{87 minutes ago}: checkout: moving from master to viz bb91ffa HEAD@{88 minutes ago}: checkout: moving from viz to master bb91ffa HEAD@{2 hours ago}: rebase finished: returning to refs/heads/viz bb91ffa HEAD@{2 hours ago}: checkout: moving from viz to bb91ffa3db35852bf6e9b15855421a1c5117b2f2^0 df9529a HEAD@{2 hours ago}: checkout: moving from master to viz bb91ffa HEAD@{2 hours ago}: pull origin master: Fast-forward cceee83 HEAD@{2 hours ago}: reset: moving to HEAD~23 df9529a HEAD@{2 hours ago}: checkout: moving from viz to master df9529a HEAD@{2 hours ago}: checkout: moving from master to viz df9529a HEAD@{6 hours ago}: checkout: moving from master to master df9529a HEAD@{18 hours ago}: checkout: moving from master to master df9529a HEAD@{18 hours ago}: checkout: moving from master to master df9529a HEAD@{18 hours ago}: reset: moving to df9529a4249b9de9cc1956283e5210b68acfe507 6633b41 HEAD@{18 hours ago}: pull origin master: Fast-forward df9529a HEAD@{18 hours ago}: reset: moving to df9529a4249b9de9cc1956283e5210b68acfe507 6633b41 HEAD@{18 hours ago}: checkout: moving from master to master 6633b41 HEAD@{18 hours ago}: pull origin master: Merge made by the 'recursive' strategy. df9529a HEAD@{18 hours ago}: checkout: moving from master to master df9529a HEAD@{18 hours ago}: rebase finished: returning to refs/heads/master df9529a HEAD@{18 hours ago}: rebase: Fixed some visualization bug, added resources for new spark visualization, deleted obsolete resources 8944283 HEAD@{18 hours ago}: rebase: Clean up social-sticky-widget. f9bc439 HEAD@{18 hours ago}: rebase: Resolve build error 14373e3 HEAD@{18 hours ago}: rebase: Changed social-widget add-friend-button binding names. abf30b9 HEAD@{18 hours ago}: rebase: Added social-sticky-widget to the community lounge. d01d4da HEAD@{18 hours ago}: rebase: Extend email support. 0a60fe0 HEAD@{18 hours ago}: rebase: Fixed asyncronous text and slowed plane by 50%. (37.5% slower in total than original speed) 4777fdd HEAD@{18 hours ago}: rebase: Added social-sticky-widget. e744734 HEAD@{18 hours ago}: rebase: Slowed plane speed down by 25% and increased the font size. 52137b7 HEAD@{18 hours ago}: rebase: Fixed some graphical glitches with the plane. 6e60b86 HEAD@{18 hours ago}: rebase: Updated the header and island to only show nature path in demo. 23c8ccb HEAD@{18 hours ago}: rebase: Added plane to the header and remove dock from production. 1107a7e HEAD@{18 hours ago}: rebase: Show completed Quests in Activity Summary. 260f8c5 HEAD@{18 hours ago}: rebase: Added dock to header and island swf. 0819d2c HEAD@{18 hours ago}: rebase: [DE575] Change friend bonus percentage. 17685ba HEAD@{18 hours ago}: rebase: Improve level queries. 35d69b4 HEAD@{18 hours ago}: rebase: Refactor Period. 9749d52 HEAD@{18 hours ago}: rebase: Make sure to use correct date range. 180b648 HEAD@{18 hours ago}: rebase: Added fix for images that were not working in IE8 and cleaned up some commented code. f94e317 HEAD@{18 hours ago}: checkout: moving from master to f94e317e82ea939a931cdc691e267e7c64f4dc00^0 38f2bb6 HEAD@{19 hours ago}: commit: Fixed some visualization bug, added resources for new spark visualization, deleted obsolete resources 98f2a97 HEAD@{19 hours ago}: pull origin master: Fast-forward b325a96 HEAD@{32 hours ago}: pull origin master: Fast-forward f94e317 HEAD@{8 days ago}: checkout: moving from f884b312dcdb247ddf7eaf7c11eb9ffaab034b40 to master f884b31 HEAD@{8 days ago}: checkout: moving from master to f884b312dcdb247ddf7eaf7c11eb9ffaab034b40^0 f94e317 HEAD@{8 days ago}: commit: Fixed visualizations scaling and integration of nature visualization 5ab4887 HEAD@{8 days ago}: pull origin master: Fast-forward 564abdd HEAD@{9 days ago}: pull origin master: Fast-forward 283c602 HEAD@{11 days ago}: pull origin master: Fast-forward I have left it in just to be complete but you should ignore everything "2 hours ago" and more recent. (I fixed the problem and told him to pull again; the advantage of a small team.) This leads to 2 new questions. 1) What does "checkout: moving from master to master" mean? 2) I'm guessing the root of the problem is "pull origin master: Merge made by the 'recursive' strategy."? I do not see a push anywhere, though. > You can see the new commit SHA-1's on the lines that say "rebase: > <original commit message>" > > But there are other ways to rewrite history, such as filter-branch. Given that *I* do not even really know about that, I doubt he would. :-) > You can also compare the commits to see what the differences are. > This may trigger the developer's memory about how it might have > happened. The only differences seem to be the SHA-1s. Cheers, Hilco -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html