{"thread":{"id":"30873","subject":"Master and origin/master diverged","startedAt":"2012-06-22T17:53:29Z","lastAt":"2012-06-27T05:54:47Z","messageCount":13,"participants":["Hilco Wijbenga","Phil Hord","Neal Kreitzinger","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"194083","messageId":"CAE1pOi1Ot0Fyv=2_XYKyUcsKp-m+CkT-miF=jC=wt9Rbz_dXqQ@mail.gmail.com","threadId":"30873","inReplyTo":null,"subject":"Master and origin/master diverged","fromName":"Hilco Wijbenga","fromEmail":"hilco.wijbenga@gmail.com","sentAt":"2012-06-22T17:53:29Z","receivedAt":"2012-06-22T17:53:29Z","isPatch":false,"sender":{"key":"hilco.wijbenga@gmail.com","avatar":null},"body":"Hi all,\n\nOne of my developers managed to push something that somehow \"diverged\"\norigin/master from everyone else's local master.\n\nA --> B --> C --> D (everybody's local master)\n|\n\\--> B' --> C' --> D' --> E (origin/master)\n\n(i.e., A is the commit where things diverged; everyone's local master\npoints to D but the new commit (E) that was pushed to origin/master\nuses different SHA1s for B, C, and D). I hope I explained it clearly\nenough.\n\nNow running git pull creates a merge commit joining D and E.\n\nWhen I asked the developer what he had done he told me everything had\nlooked normal. No Git warnings, nothing strange in gitk (i.e. normal\nlinear history). So I do not understand what went wrong.\n\nDoes anyone have any idea as to what might have happened? Perhaps if I\nunderstand how this happened I might be able to prevent it from\nhappening again.\n\nCheers,\nHilco\n"},{"id":"194089","messageId":"CABURp0oCrmJzfFtX9UujMfoTPeCBPeuri6pb4nTq57XvuO98aQ@mail.gmail.com","threadId":"30873","inReplyTo":"CAE1pOi1Ot0Fyv=2_XYKyUcsKp-m+CkT-miF=jC=wt9Rbz_dXqQ@mail.gmail.com","subject":"Re: Master and origin/master diverged","fromName":"Phil Hord","fromEmail":"phil.hord@gmail.com","sentAt":"2012-06-22T18:34:35Z","receivedAt":"2012-06-22T18:34:35Z","isPatch":false,"sender":{"key":"phil.hord@gmail.com","avatar":"https://avatars.githubusercontent.com/u/123908?v=4"},"body":"On Fri, Jun 22, 2012 at 1:53 PM, Hilco Wijbenga\n<hilco.wijbenga@gmail.com> wrote:\n> One of my developers managed to push something that somehow \"diverged\"\n> origin/master from everyone else's local master.\n>\n> A --> B --> C --> D (everybody's local master)\n> |\n> \\--> B' --> C' --> D' --> E (origin/master)\n>\n> (i.e., A is the commit where things diverged; everyone's local master\n> points to D but the new commit (E) that was pushed to origin/master\n> uses different SHA1s for B, C, and D). I hope I explained it clearly\n> enough.\n>\n> Now running git pull creates a merge commit joining D and E.\n>\n> When I asked the developer what he had done he told me everything had\n> looked normal. No Git warnings, nothing strange in gitk (i.e. normal\n> linear history). So I do not understand what went wrong.\n>\n> Does anyone have any idea as to what might have happened? Perhaps if I\n> understand how this happened I might be able to prevent it from\n> happening again.\n\nThere are a number of ways this can happen, but they all involve\nrewriting history.  Usually that is something your developer would be\naware of doing.  It does not usually happen by mistake.\n\nAlso, in order to push the new E commit, the developer would have to\n\"force\" the push by placing a \"+\" in front of the references, like\nthis:\n\n  git push origin +master:master\n\nIf he used a gui, then I do not know how this option would be spelled,\nbut it may be called \"force\" or something else.\n\nYou can look at the reflog on the developer's machine to determine\nwhere the new commits came from.  For example, here are some commits I\nrebased a few weeks ago in a repository on my machine:\n\n$ git reflog --relative-date\nc93b31b HEAD@{6 weeks ago}: checkout: moving from mine to c93b31b\n93a357f HEAD@{6 weeks ago}: rebase finished: returning to refs/heads/mine\n93a357f HEAD@{6 weeks ago}: rebase: Add a makefile to help me remember\nhow to make\nf804993 HEAD@{6 weeks ago}: rebase: Allow working in multiple branches\nc93b31b HEAD@{6 weeks ago}: rebase: Update Gerrit 2.4 ReleaseNotes\n5cac09e HEAD@{6 weeks ago}: rebase: Gerrit 2.4 ReleaseNotes\nf41a9b4 HEAD@{6 weeks ago}: checkout: moving from mine to\nf41a9b447304733a1784ece373723f8622c8dbad^0\n879e5d9 HEAD@{6 weeks ago}: rebase finished: returning to refs/heads/mine\n879e5d9 HEAD@{6 weeks ago}: rebase: Add a makefile to help me remember\nhow to make\n35d7a48 HEAD@{6 weeks ago}: rebase: Allow working in multiple branches\nc7a845a HEAD@{6 weeks ago}: rebase: Update Gerrit 2.4 ReleaseNotes\n7b51315 HEAD@{6 weeks ago}: rebase: Gerrit 2.4 ReleaseNotes\nd6799b1 HEAD@{6 weeks ago}: checkout: moving from mine to\nd6799b1d40ffc5412e4174fd95bd5fb412781537^0\nd9bb39b HEAD@{6 weeks ago}: checkout: moving from\nd6799b1d40ffc5412e4174fd95bd5fb412781537 to mine\nd6799b1 HEAD@{6 weeks ago}: checkout: moving from mine to origin/master\nd9bb39b HEAD@{6 weeks ago}: commit (amend): Add a makefile to help me\nremember how to make\n62097f8 HEAD@{6 weeks ago}: commit: Add a makefile to help me remember\nhow to make\ndfa61e4 HEAD@{6 weeks ago}: checkout: moving from\ndfa61e465bcb27f5698c48d1ec9d32e8fd62c604 to mine\n\n\nYou can see the new commit SHA-1's on the lines that say \"rebase:\n<original commit message>\"\n\nBut there are other ways to rewrite history, such as filter-branch.\n\nYou can also compare the commits to see what the differences are.\nThis may trigger  the developer's memory about how it might have\nhappened.\n\nPhil\n"},{"id":"194091","messageId":"4FE4C0F7.2080309@gmail.com","threadId":"30873","inReplyTo":"CAE1pOi1Ot0Fyv=2_XYKyUcsKp-m+CkT-miF=jC=wt9Rbz_dXqQ@mail.gmail.com","subject":"Re: Master and origin/master diverged","fromName":"Neal Kreitzinger","fromEmail":"nkreitzinger@gmail.com","sentAt":"2012-06-22T19:01:11Z","receivedAt":"2012-06-22T19:01:11Z","isPatch":false,"sender":{"key":"nkreitzinger@gmail.com","avatar":null},"body":"On 6/22/2012 12:53 PM, Hilco Wijbenga wrote:\n> Hi all,\n>\n> One of my developers managed to push something that somehow \"diverged\"\n> origin/master from everyone else's local master.\n>\n> A --> B --> C --> D (everybody's local master)\n> |\n> \\--> B' --> C' --> D' --> E (origin/master)\n>\n> (i.e., A is the commit where things diverged; everyone's local master\n> points to D but the new commit (E) that was pushed to origin/master\n> uses different SHA1s for B, C, and D). I hope I explained it clearly\n> enough.\n>\n> Now running git pull creates a merge commit joining D and E.\n>\n> When I asked the developer what he had done he told me everything had\n> looked normal. No Git warnings, nothing strange in gitk (i.e. normal\n> linear history). So I do not understand what went wrong.\n>\n> Does anyone have any idea as to what might have happened? Perhaps if I\n> understand how this happened I might be able to prevent it from\n> happening again.\n>\nSome ways you can prevent it from happening again:\n(1) setting your canonical repo config to deny non-ff, and deny deletes:\n[receive]\n         denyDeletes = true\n         denyNonFastforwards = true\n(2) have your devs do git pull --ff-only\n\nv/r,\nneal\n"},{"id":"194097","messageId":"CAE1pOi3pe4KKeJ4B74T8besvbiJh-dJz5efB-qJLsbmK+f_YLQ@mail.gmail.com","threadId":"30873","inReplyTo":"CABURp0oCrmJzfFtX9UujMfoTPeCBPeuri6pb4nTq57XvuO98aQ@mail.gmail.com","subject":"Re: Master and origin/master diverged","fromName":"Hilco Wijbenga","fromEmail":"hilco.wijbenga@gmail.com","sentAt":"2012-06-22T20:14:03Z","receivedAt":"2012-06-22T20:14:03Z","isPatch":false,"sender":{"key":"hilco.wijbenga@gmail.com","avatar":null},"body":"Hi Phil,\n\nOn 22 June 2012 11:34, Phil Hord <phil.hord@gmail.com> wrote:\n> On Fri, Jun 22, 2012 at 1:53 PM, Hilco Wijbenga\n> <hilco.wijbenga@gmail.com> wrote:\n>> One of my developers managed to push something that somehow \"diverged\"\n>> origin/master from everyone else's local master.\n>>\n>> A --> B --> C --> D (everybody's local master)\n>> |\n>> \\--> B' --> C' --> D' --> E (origin/master)\n>>\n>> (i.e., A is the commit where things diverged; everyone's local master\n>> points to D but the new commit (E) that was pushed to origin/master\n>> uses different SHA1s for B, C, and D). I hope I explained it clearly\n>> enough.\n>>\n>> Now running git pull creates a merge commit joining D and E.\n>>\n>> When I asked the developer what he had done he told me everything had\n>> looked normal. No Git warnings, nothing strange in gitk (i.e. normal\n>> linear history). So I do not understand what went wrong.\n>>\n>> Does anyone have any idea as to what might have happened? Perhaps if I\n>> understand how this happened I might be able to prevent it from\n>> happening again.\n>\n> There are a number of ways this can happen, but they all involve\n> rewriting history.  Usually that is something your developer would be\n> aware of doing.  It does not usually happen by mistake.\n\nMy thoughts exactly.\n\n> Also, in order to push the new E commit, the developer would have to\n> \"force\" the push by placing a \"+\" in front of the references, like\n> this:\n>\n>  git push origin +master:master\n\nIs that the same as\n\ngit push --force origin master\n\n?\n\n> If he used a gui, then I do not know how this option would be spelled,\n> but it may be called \"force\" or something else.\n\nAFAIK, he uses the CL for this. No GUI.\n\n> You can look at the reflog on the developer's machine to determine\n> where the new commits came from.  For example, here are some commits I\n> rebased a few weeks ago in a repository on my machine:\n>\n> $ git reflog --relative-date\n> c93b31b HEAD@{6 weeks ago}: checkout: moving from mine to c93b31b\n> 93a357f HEAD@{6 weeks ago}: rebase finished: returning to refs/heads/mine\n> 93a357f HEAD@{6 weeks ago}: rebase: Add a makefile to help me remember\n> how to make\n> f804993 HEAD@{6 weeks ago}: rebase: Allow working in multiple branches\n> c93b31b HEAD@{6 weeks ago}: rebase: Update Gerrit 2.4 ReleaseNotes\n> 5cac09e HEAD@{6 weeks ago}: rebase: Gerrit 2.4 ReleaseNotes\n> f41a9b4 HEAD@{6 weeks ago}: checkout: moving from mine to\n> f41a9b447304733a1784ece373723f8622c8dbad^0\n> 879e5d9 HEAD@{6 weeks ago}: rebase finished: returning to refs/heads/mine\n> 879e5d9 HEAD@{6 weeks ago}: rebase: Add a makefile to help me remember\n> how to make\n> 35d7a48 HEAD@{6 weeks ago}: rebase: Allow working in multiple branches\n> c7a845a HEAD@{6 weeks ago}: rebase: Update Gerrit 2.4 ReleaseNotes\n> 7b51315 HEAD@{6 weeks ago}: rebase: Gerrit 2.4 ReleaseNotes\n> d6799b1 HEAD@{6 weeks ago}: checkout: moving from mine to\n> d6799b1d40ffc5412e4174fd95bd5fb412781537^0\n> d9bb39b HEAD@{6 weeks ago}: checkout: moving from\n> d6799b1d40ffc5412e4174fd95bd5fb412781537 to mine\n> d6799b1 HEAD@{6 weeks ago}: checkout: moving from mine to origin/master\n> d9bb39b HEAD@{6 weeks ago}: commit (amend): Add a makefile to help me\n> remember how to make\n> 62097f8 HEAD@{6 weeks ago}: commit: Add a makefile to help me remember\n> how to make\n> dfa61e4 HEAD@{6 weeks ago}: checkout: moving from\n> dfa61e465bcb27f5698c48d1ec9d32e8fd62c604 to mine\n\nbb91ffa HEAD@{87 minutes ago}: checkout: moving from master to viz\nbb91ffa HEAD@{88 minutes ago}: checkout: moving from viz to master\nbb91ffa HEAD@{2 hours ago}: rebase finished: returning to refs/heads/viz\nbb91ffa HEAD@{2 hours ago}: checkout: moving from viz to\nbb91ffa3db35852bf6e9b15855421a1c5117b2f2^0\ndf9529a HEAD@{2 hours ago}: checkout: moving from master to viz\nbb91ffa HEAD@{2 hours ago}: pull origin master: Fast-forward\ncceee83 HEAD@{2 hours ago}: reset: moving to HEAD~23\ndf9529a HEAD@{2 hours ago}: checkout: moving from viz to master\ndf9529a HEAD@{2 hours ago}: checkout: moving from master to viz\ndf9529a HEAD@{6 hours ago}: checkout: moving from master to master\ndf9529a HEAD@{18 hours ago}: checkout: moving from master to master\ndf9529a HEAD@{18 hours ago}: checkout: moving from master to master\ndf9529a HEAD@{18 hours ago}: reset: moving to\ndf9529a4249b9de9cc1956283e5210b68acfe507\n6633b41 HEAD@{18 hours ago}: pull origin master: Fast-forward\ndf9529a HEAD@{18 hours ago}: reset: moving to\ndf9529a4249b9de9cc1956283e5210b68acfe507\n6633b41 HEAD@{18 hours ago}: checkout: moving from master to master\n6633b41 HEAD@{18 hours ago}: pull origin master: Merge made by the\n'recursive' strategy.\ndf9529a HEAD@{18 hours ago}: checkout: moving from master to master\ndf9529a HEAD@{18 hours ago}: rebase finished: returning to refs/heads/master\ndf9529a HEAD@{18 hours ago}: rebase: Fixed some visualization bug,\nadded resources for new spark visualization, deleted obsolete\nresources\n8944283 HEAD@{18 hours ago}: rebase: Clean up social-sticky-widget.\nf9bc439 HEAD@{18 hours ago}: rebase: Resolve build error\n14373e3 HEAD@{18 hours ago}: rebase: Changed social-widget\nadd-friend-button binding names.\nabf30b9 HEAD@{18 hours ago}: rebase: Added social-sticky-widget to the\ncommunity lounge.\nd01d4da HEAD@{18 hours ago}: rebase: Extend email support.\n0a60fe0 HEAD@{18 hours ago}: rebase: Fixed asyncronous text and slowed\nplane by 50%. (37.5% slower in total than original speed)\n4777fdd HEAD@{18 hours ago}: rebase: Added social-sticky-widget.\ne744734 HEAD@{18 hours ago}: rebase: Slowed plane speed down by 25%\nand increased the font size.\n52137b7 HEAD@{18 hours ago}: rebase: Fixed some graphical glitches\nwith the plane.\n6e60b86 HEAD@{18 hours ago}: rebase: Updated the header and island to\nonly show nature path in demo.\n23c8ccb HEAD@{18 hours ago}: rebase: Added plane to the header and\nremove dock from production.\n1107a7e HEAD@{18 hours ago}: rebase: Show completed Quests in Activity Summary.\n260f8c5 HEAD@{18 hours ago}: rebase: Added dock to header and island swf.\n0819d2c HEAD@{18 hours ago}: rebase: [DE575] Change friend bonus percentage.\n17685ba HEAD@{18 hours ago}: rebase: Improve level queries.\n35d69b4 HEAD@{18 hours ago}: rebase: Refactor Period.\n9749d52 HEAD@{18 hours ago}: rebase: Make sure to use correct date range.\n180b648 HEAD@{18 hours ago}: rebase: Added fix for images that were\nnot working in IE8 and cleaned up some commented code.\nf94e317 HEAD@{18 hours ago}: checkout: moving from master to\nf94e317e82ea939a931cdc691e267e7c64f4dc00^0\n38f2bb6 HEAD@{19 hours ago}: commit: Fixed some visualization bug,\nadded resources for new spark visualization, deleted obsolete\nresources\n98f2a97 HEAD@{19 hours ago}: pull origin master: Fast-forward\nb325a96 HEAD@{32 hours ago}: pull origin master: Fast-forward\nf94e317 HEAD@{8 days ago}: checkout: moving from\nf884b312dcdb247ddf7eaf7c11eb9ffaab034b40 to master\nf884b31 HEAD@{8 days ago}: checkout: moving from master to\nf884b312dcdb247ddf7eaf7c11eb9ffaab034b40^0\nf94e317 HEAD@{8 days ago}: commit: Fixed visualizations scaling and\nintegration of nature visualization\n5ab4887 HEAD@{8 days ago}: pull origin master: Fast-forward\n564abdd HEAD@{9 days ago}: pull origin master: Fast-forward\n283c602 HEAD@{11 days ago}: pull origin master: Fast-forward\n\nI have left it in just to be complete but you should ignore everything\n\"2 hours ago\" and more recent. (I fixed the problem and told him to\npull again; the advantage of a small team.)\n\nThis leads to 2 new questions.\n\n1) What does \"checkout: moving from master to master\" mean?\n2) I'm guessing the root of the problem is \"pull origin master: Merge\nmade by the 'recursive' strategy.\"? I do not see a push anywhere,\nthough.\n\n> You can see the new commit SHA-1's on the lines that say \"rebase:\n> <original commit message>\"\n>\n> But there are other ways to rewrite history, such as filter-branch.\n\nGiven that *I* do not even really know about that, I doubt he would. :-)\n\n> You can also compare the commits to see what the differences are.\n> This may trigger  the developer's memory about how it might have\n> happened.\n\nThe only differences seem to be the SHA-1s.\n\nCheers,\nHilco\n"},{"id":"194098","messageId":"CAE1pOi2MN_c76UBeRzdRbU8s+0LzYVoVcJ13V0di=HQobj+aDg@mail.gmail.com","threadId":"30873","inReplyTo":"4FE4C0F7.2080309@gmail.com","subject":"Re: Master and origin/master diverged","fromName":"Hilco Wijbenga","fromEmail":"hilco.wijbenga@gmail.com","sentAt":"2012-06-22T20:18:16Z","receivedAt":"2012-06-22T20:18:16Z","isPatch":false,"sender":{"key":"hilco.wijbenga@gmail.com","avatar":null},"body":"Hi Neal,\n\nOn 22 June 2012 12:01, Neal Kreitzinger <nkreitzinger@gmail.com> wrote:\n> On 6/22/2012 12:53 PM, Hilco Wijbenga wrote:\n>>\n>> Hi all,\n>>\n>> One of my developers managed to push something that somehow \"diverged\"\n>> origin/master from everyone else's local master.\n>>\n>> A --> B --> C --> D (everybody's local master)\n>> |\n>> \\--> B' --> C' --> D' --> E (origin/master)\n>>\n>> (i.e., A is the commit where things diverged; everyone's local master\n>> points to D but the new commit (E) that was pushed to origin/master\n>> uses different SHA1s for B, C, and D). I hope I explained it clearly\n>> enough.\n>>\n>> Now running git pull creates a merge commit joining D and E.\n>>\n>> When I asked the developer what he had done he told me everything had\n>> looked normal. No Git warnings, nothing strange in gitk (i.e. normal\n>> linear history). So I do not understand what went wrong.\n>>\n>> Does anyone have any idea as to what might have happened? Perhaps if I\n>> understand how this happened I might be able to prevent it from\n>> happening again.\n>>\n> Some ways you can prevent it from happening again:\n> (1) setting your canonical repo config to deny non-ff, and deny deletes:\n> [receive]\n>        denyDeletes = true\n>        denyNonFastforwards = true\n\nI would *really* like to do that but I need access to the server for\nthat, right? Unfortunately, we use Unfuddle and that means no such\naccess. So no server config changes and no Git hooks.\n\n> (2) have your devs do git pull --ff-only\n\nIs this something that can be set in git config? I looked but didn't\nsee anything obvious. Actually, I guess what I really want is\nsomething for git push, right?\n"},{"id":"194108","messageId":"CABURp0rhVi+pi4YjCfQqMpcjV2rYKQHPQ3QUZ49h0gjERAS4Qg@mail.gmail.com","threadId":"30873","inReplyTo":"CAE1pOi3pe4KKeJ4B74T8besvbiJh-dJz5efB-qJLsbmK+f_YLQ@mail.gmail.com","subject":"Re: Master and origin/master diverged","fromName":"Phil Hord","fromEmail":"phil.hord@gmail.com","sentAt":"2012-06-22T22:10:44Z","receivedAt":"2012-06-22T22:10:44Z","isPatch":false,"sender":{"key":"phil.hord@gmail.com","avatar":"https://avatars.githubusercontent.com/u/123908?v=4"},"body":"On Fri, Jun 22, 2012 at 4:14 PM, Hilco Wijbenga\n<hilco.wijbenga@gmail.com> wrote:\n>> You can also compare the commits to see what the differences are.\n>> This may trigger  the developer's memory about how it might have\n>> happened.\n>\n> The only differences seem to be the SHA-1s.\n\n\nCan you tell me which SHA-1s they are?  It will be easier for me to\nguess at the reflog contents, then.\n\nPhil\n"},{"id":"194114","messageId":"CAE1pOi0zkDa=scowaaT=VdLjdYL2UPW++e0ZXLrzU6kncX8-ow@mail.gmail.com","threadId":"30873","inReplyTo":"CABURp0rhVi+pi4YjCfQqMpcjV2rYKQHPQ3QUZ49h0gjERAS4Qg@mail.gmail.com","subject":"Re: Master and origin/master diverged","fromName":"Hilco Wijbenga","fromEmail":"hilco.wijbenga@gmail.com","sentAt":"2012-06-22T22:33:05Z","receivedAt":"2012-06-22T22:33:05Z","isPatch":false,"sender":{"key":"hilco.wijbenga@gmail.com","avatar":null},"body":"On 22 June 2012 15:10, Phil Hord <phil.hord@gmail.com> wrote:\n> On Fri, Jun 22, 2012 at 4:14 PM, Hilco Wijbenga\n> <hilco.wijbenga@gmail.com> wrote:\n>>> You can also compare the commits to see what the differences are.\n>>> This may trigger  the developer's memory about how it might have\n>>> happened.\n>>\n>> The only differences seem to be the SHA-1s.\n>\n> Can you tell me which SHA-1s they are?  It will be easier for me to\n> guess at the reflog contents, then.\n\nYou mean which SHA-1s in the reflog? It's the ones listed as @{\"18\nhours ago\"}: rebase: ... Sorry, I should have pointed that out.\n\nThe reflog lists the SHA-1s that the dev had and that were pushed to\norigin/master (so B', C', and D' in my original description). The ones\nthat were on origin/master originally (and are/were on my local\nmaster) are different (B, C, and D).\n"},{"id":"194119","messageId":"4FE50411.8080800@gmail.com","threadId":"30873","inReplyTo":"CAE1pOi2MN_c76UBeRzdRbU8s+0LzYVoVcJ13V0di=HQobj+aDg@mail.gmail.com","subject":"Re: Master and origin/master diverged","fromName":"Neal Kreitzinger","fromEmail":"nkreitzinger@gmail.com","sentAt":"2012-06-22T23:47:29Z","receivedAt":"2012-06-22T23:47:29Z","isPatch":false,"sender":{"key":"nkreitzinger@gmail.com","avatar":null},"body":"On 6/22/2012 3:18 PM, Hilco Wijbenga wrote:\n>\n> On 22 June 2012 12:01, Neal Kreitzinger <nkreitzinger@gmail.com> wrote:\n>> On 6/22/2012 12:53 PM, Hilco Wijbenga wrote:\n>>>\n>>> One of my developers managed to push something that somehow \"diverged\"\n>>> origin/master from everyone else's local master.\n>>>\n>>> A --> B --> C --> D (everybody's local master)\n>>> |\n>>> \\--> B' --> C' --> D' --> E (origin/master)\n>>>\n>>> (i.e., A is the commit where things diverged; everyone's local master\n>>> points to D but the new commit (E) that was pushed to origin/master\n>>> uses different SHA1s for B, C, and D)...\n>>>\n>>> Now running git pull creates a merge commit joining D and E.\n>>>\n>>> ...Does anyone have any idea as to what might have happened? Perhaps if I\n>>> understand how this happened I might be able to prevent it from\n>>> happening again.\n>>>\n>> Some ways you can prevent it from happening again:\n>\n>> (2) have your devs do git pull --ff-only\n>\n> Is this something that can be set in git config? I looked but didn't\n> see anything obvious.\n\nOTTOMH, you could change the git fetch config for master and take away \nthe leading '+' sign which would not allow non-fastforward fetches of \nmaster.  That in turn would prevent merging such a non-ff remote \ntracking branch of master into your branch master.\n\nActually, I guess what I really want is\n> something for git push, right?\n>\nSome ways to do it:\n(1) I think you could have rebase and commit hooks locally that prevent \nsomeone from rewriting history on master.  That in turn would prevent \nsomeone from pushing a rewritten history.\n(2) When merging topic branches to master use git merge --ff-only.  Then \nwhen you push it to remote master you know it's a fastforward and not a \nhistory rewrite.\n\nv/r,\nneal\n"},{"id":"194121","messageId":"7v1ul6nbju.fsf@alter.siamese.dyndns.org","threadId":"30873","inReplyTo":"CAE1pOi2MN_c76UBeRzdRbU8s+0LzYVoVcJ13V0di=HQobj+aDg@mail.gmail.com","subject":"Re: Master and origin/master diverged","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-06-22T23:59:01Z","receivedAt":"2012-06-22T23:59:01Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Hilco Wijbenga <hilco.wijbenga@gmail.com> writes:\n\n>> Some ways you can prevent it from happening again:\n>> (1) setting your canonical repo config to deny non-ff, and deny deletes:\n>> [receive]\n>>        denyDeletes = true\n>>        denyNonFastforwards = true\n>\n> I would *really* like to do that but I need access to the server for\n> that, right? Unfortunately, we use Unfuddle and that means no such\n> access. So no server config changes and no Git hooks.\n\nreceive.denyNonFastforwards is a reasonable thing to ask for\nprojects with a shared repository workflow, so I suspect hosting\nservice providers may want to race adding support for it to win\ncustomers.  Have you asked them?\n"},{"id":"194252","messageId":"CAE1pOi24EVq__XzxtBoAryzQ+F=sAy8-hY23M-P4YoQFXdpSSw@mail.gmail.com","threadId":"30873","inReplyTo":"4FE50411.8080800@gmail.com","subject":"Re: Master and origin/master diverged","fromName":"Hilco Wijbenga","fromEmail":"hilco.wijbenga@gmail.com","sentAt":"2012-06-26T02:49:18Z","receivedAt":"2012-06-26T02:49:18Z","isPatch":false,"sender":{"key":"hilco.wijbenga@gmail.com","avatar":null},"body":"On 22 June 2012 16:47, Neal Kreitzinger <nkreitzinger@gmail.com> wrote:\n> On 6/22/2012 3:18 PM, Hilco Wijbenga wrote:\n>>\n>>\n>> On 22 June 2012 12:01, Neal Kreitzinger <nkreitzinger@gmail.com> wrote:\n>>>\n>>> On 6/22/2012 12:53 PM, Hilco Wijbenga wrote:\n>>>>\n>>>>\n>>>> One of my developers managed to push something that somehow \"diverged\"\n>>>> origin/master from everyone else's local master.\n>>>>\n>>>> A --> B --> C --> D (everybody's local master)\n>>>> |\n>>>> \\--> B' --> C' --> D' --> E (origin/master)\n>>>>\n>>>> (i.e., A is the commit where things diverged; everyone's local master\n>>>> points to D but the new commit (E) that was pushed to origin/master\n>>>> uses different SHA1s for B, C, and D)...\n>>>>\n>>>>\n>>>> Now running git pull creates a merge commit joining D and E.\n>>>>\n>>>> ...Does anyone have any idea as to what might have happened? Perhaps if\n>>>> I\n>>>>\n>>>> understand how this happened I might be able to prevent it from\n>>>> happening again.\n>>>>\n>>> Some ways you can prevent it from happening again:\n>>\n>>\n>>> (2) have your devs do git pull --ff-only\n>>\n>>\n>> Is this something that can be set in git config? I looked but didn't\n>> see anything obvious.\n>\n>\n> OTTOMH, you could change the git fetch config for master and take away the\n> leading '+' sign which would not allow non-fastforward fetches of master.\n>  That in turn would prevent merging such a non-ff remote tracking branch of\n> master into your branch master.\n>\n>\n> Actually, I guess what I really want is\n>>\n>> something for git push, right?\n>>\n> Some ways to do it:\n> (1) I think you could have rebase and commit hooks locally that prevent\n> someone from rewriting history on master.  That in turn would prevent\n> someone from pushing a rewritten history.\n\nYes, I have been thinking about that.\n\nHow does one create \"portable\" hooks? I have to deal with GNU/Linux,\nOS X, and MS Windows. We all have Java installed so I first thought of\nusing JGit but I am not clear on how well JGit supports using it in a\nhooks. Should I make Ruby a required part of the dev environment and\nuse Ruby hooks?\n\n> (2) When merging topic branches to master use git merge --ff-only.  Then\n> when you push it to remote master you know it's a fastforward and not a\n> history rewrite.\n\nGiven how hard it is to teach devs to only push fast-forward merges, I\nam not sure how well this would work.\n"},{"id":"194253","messageId":"CAE1pOi1JU1QvYOJeV2qC3EN=b==HE1nn+DvXBGNro0mROctsvQ@mail.gmail.com","threadId":"30873","inReplyTo":"7v1ul6nbju.fsf@alter.siamese.dyndns.org","subject":"Re: Master and origin/master diverged","fromName":"Hilco Wijbenga","fromEmail":"hilco.wijbenga@gmail.com","sentAt":"2012-06-26T02:58:09Z","receivedAt":"2012-06-26T02:58:09Z","isPatch":false,"sender":{"key":"hilco.wijbenga@gmail.com","avatar":null},"body":"On 22 June 2012 16:59, Junio C Hamano <gitster@pobox.com> wrote:\n> Hilco Wijbenga <hilco.wijbenga@gmail.com> writes:\n>\n>>> Some ways you can prevent it from happening again:\n>>> (1) setting your canonical repo config to deny non-ff, and deny deletes:\n>>> [receive]\n>>>        denyDeletes = true\n>>>        denyNonFastforwards = true\n>>\n>> I would *really* like to do that but I need access to the server for\n>> that, right? Unfortunately, we use Unfuddle and that means no such\n>> access. So no server config changes and no Git hooks.\n>\n> receive.denyNonFastforwards is a reasonable thing to ask for\n> projects with a shared repository workflow, so I suspect hosting\n> service providers may want to race adding support for it to win\n> customers.  Have you asked them?\n\nI agree and I was thinking of doing exactly that. So after your\nfriendly nudge I sent them an email.\n\nThe first (very prompt) reply said they didn't support \"custom hooks\".\nWhen I explained that I was not asking for a custom hook but that I\nsimply wanted a Git setting changed, I was informed (again, very\npromptly)  that that was quite impossible. :-(\n\nIn my opinion, it should be fairly simple for them to create a web UI\nto set Git config settings (I can understand they do not want to do it\nmanually) but they do not seem very interested. A bit surprising and\ncertainly very disappointing.\n"},{"id":"194259","messageId":"7vy5nad86a.fsf@alter.siamese.dyndns.org","threadId":"30873","inReplyTo":"CAE1pOi1JU1QvYOJeV2qC3EN=b==HE1nn+DvXBGNro0mROctsvQ@mail.gmail.com","subject":"Re: Master and origin/master diverged","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-06-26T04:11:09Z","receivedAt":"2012-06-26T04:11:09Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Hilco Wijbenga <hilco.wijbenga@gmail.com> writes:\n\n> I agree and I was thinking of doing exactly that. So after your\n> friendly nudge I sent them an email.\n>\n> The first (very prompt) reply said they didn't support \"custom hooks\".\n> When I explained that I was not asking for a custom hook but that I\n> simply wanted a Git setting changed, I was informed (again, very\n> promptly)  that that was quite impossible. :-(\n>\n> In my opinion, it should be fairly simple for them to create a web UI\n> to set Git config settings (I can understand they do not want to do it\n> manually) but they do not seem very interested. A bit surprising and\n> certainly very disappointing.\n\nWell, there seem to be other Git hosting services with commercial\nsupport and this might be a marketing opportunity for them ;-).\n"},{"id":"194333","messageId":"4FEAA027.7050307@gmail.com","threadId":"30873","inReplyTo":"CAE1pOi24EVq__XzxtBoAryzQ+F=sAy8-hY23M-P4YoQFXdpSSw@mail.gmail.com","subject":"Re: Master and origin/master diverged","fromName":"Neal Kreitzinger","fromEmail":"nkreitzinger@gmail.com","sentAt":"2012-06-27T05:54:47Z","receivedAt":"2012-06-27T05:54:47Z","isPatch":false,"sender":{"key":"nkreitzinger@gmail.com","avatar":null},"body":"On 6/25/2012 9:49 PM, Hilco Wijbenga wrote:\n> On 22 June 2012 16:47, Neal Kreitzinger <nkreitzinger@gmail.com> wrote:\n>> On 6/22/2012 3:18 PM, Hilco Wijbenga wrote:\n>>>\n>>> On 22 June 2012 12:01, Neal Kreitzinger <nkreitzinger@gmail.com> wrote:\n>>>> On 6/22/2012 12:53 PM, Hilco Wijbenga wrote:\n>>>>>\n>>>>> One of my developers managed to push something that somehow \"diverged\"\n>>>>> origin/master from everyone else's local master.\n>>>>>\n>>>>> A --> B --> C --> D (everybody's local master)\n>>>>> |\n>>>>> \\--> B' --> C' --> D' --> E (origin/master)\n>>>>>\n>>>>> (i.e., A is the commit where things diverged; everyone's local master\n>>>>> points to D but the new commit (E) that was pushed to origin/master\n>>>>> uses different SHA1s for B, C, and D)...\n>>>>>\n>>>>>\n>>>>> Now running git pull creates a merge commit joining D and E.\n>>>>>\n>>>>> ...Does anyone have any idea as to what might have happened? Perhaps if\n>>>>> I\n>>>>>\n>>>>> understand how this happened I might be able to prevent it from\n>>>>> happening again.\n>>>>>\n>>>> Some ways you can prevent it from happening again:\n>>>\n>>>> (2) have your devs do git pull --ff-only\n>>>\n>>> Is this something that can be set in git config? I looked but didn't\n>>> see anything obvious.\n>>\n>> OTTOMH, you could change the git fetch config for master and take away the\n>> leading '+' sign which would not allow non-fastforward fetches of master.\n>>   That in turn would prevent merging such a non-ff remote tracking branch of\n>> master into your branch master.\n>>\n>>\n>> Actually, I guess what I really want is\n>>> something for git push, right?\n>>>\n>> Some ways to do it:\n>> (1) I think you could have rebase and commit hooks locally that prevent\n>> someone from rewriting history on master.  That in turn would prevent\n>> someone from pushing a rewritten history.\n> Yes, I have been thinking about that.\n>\n> How does one create \"portable\" hooks? I have to deal with GNU/Linux,\n> OS X, and MS Windows. We all have Java installed so I first thought of\n> using JGit but I am not clear on how well JGit supports using it in a\n> hooks. Should I make Ruby a required part of the dev environment and\n> use Ruby hooks?\nI don't know about java, ruby, or JGit (yet).  I make hook updates easy \nwith this alias:\n\nget-hooks = !rm -f .git/hooks/pre-commit && git init \n--template=/opt/mydir/git-templates/dev/templates\n\nI update the master copy of the pre-commit hook (in this case) in the \ntemplate and then have the users run git get-hooks.  All my users are on \nthe linux server.  Maybe this idea is helpful to you in some way.\n>\n>> (2) When merging topic branches to master use git merge --ff-only.  Then\n>> when you push it to remote master you know it's a fastforward and not a\n>> history rewrite.\n> Given how hard it is to teach devs to only push fast-forward merges, I\n> am not sure how well this would work.\n>\nYou could create an alias 'git merger' and have them run that and it \nwill do the --ff-only option.  Maybe post-merge hook and/or pre-commit \nhook.  I don't think --ff-only was part of your requirements so you can \nprobably ignore this since I got off track by suggesting it.  I think \nyour problem is history rewrites and not merge commits.  I think (1) \n--ff-only denies merge commits altogether, and (2) denyNonFastForwards \nallows merge commits but denies history rewrites so they (1 and 2) are \nnot really the same though they both use the term 'fastforward' they \nhave different definitions of what that means.  Someone please correct \nme if I'm wrong because this does seem a bit confusing now that I'm \nsaying it out loud.\n\nv/r,\nneal\n"}]}