{"thread":{"id":"11566","subject":"Revert git push","startedAt":"2008-01-10T13:15:20Z","lastAt":"2008-01-14T10:39:55Z","messageCount":5,"participants":["Markus Korber","Jonathan del Strother","Johannes Sixt"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"64928","messageId":"6zve61q0t3.fsf@odpc25.int.ondemand.co.at","threadId":"11566","inReplyTo":null,"subject":"Revert git push","fromName":"Markus Korber","fromEmail":"korbse@gmx.at","sentAt":"2008-01-10T13:15:20Z","receivedAt":"2008-01-10T13:15:20Z","isPatch":false,"sender":{"key":"korbse@gmx.at","avatar":null},"body":"Hi,\n\nI've got two local git repositories, linux and mplayer, where I push to\nfrom a local directory.  Now I accidentally pushed from mplayer into the\nlinux repository (via a not updated URL[1]).  Is it somehow possible to\nrevert this push if nobody has pushed something since my last pull from\nthe linux repository?\n\n(Or can I just copy the .git/objects/ directory over to the repository?)\n\n,----[ .git/remotes/mplayer [1]]\n| URL: /prj/gitroot/linux\n| Push: +master:master\n`----\n\n,----[ git push mplayer ]\n| updating 'refs/heads/master'\n|   from 94545baded0bfbabdc30a3a4cb48b3db479dd6ef\n|   to   9085d919f7954ad629447157f054e55230513936\n| Generating pack...\n| Done counting 3240 objects.\n| Deltifying 3240 objects...\n|  100% (3240/3240) done\n| Writing 3240 objects...\n|  100% (3240/3240) done\n| Total 3240 (delta 774), reused 0 (delta 0)\n| refs/heads/master: 94545baded0bfbabdc30a3a4cb48b3db479dd6ef -> 9085d919f7954ad629447157f054e55230513936\n`----\n\nRegards,\nMarkus Korber\n"},{"id":"64930","messageId":"57518fd10801100531v6f6aef85k4b1b875c6f16aeba@mail.gmail.com","threadId":"11566","inReplyTo":"6zve61q0t3.fsf@odpc25.int.ondemand.co.at","subject":"Re: Revert git push","fromName":"Jonathan del Strother","fromEmail":"maillist@steelskies.com","sentAt":"2008-01-10T13:31:59Z","receivedAt":"2008-01-10T13:31:59Z","isPatch":false,"sender":{"key":"jon.delstrother@bestbefore.tv","avatar":"https://gravatar.com/avatar/754e21ab701c00e2d21fc261187254c34b2a1c0b959d9ee5be1a295990be3081?d=mp&s=160"},"body":"On Jan 10, 2008 1:15 PM, Markus Korber <korbse@gmx.at> wrote:\n> Hi,\n>\n> I've got two local git repositories, linux and mplayer, where I push to\n> from a local directory.  Now I accidentally pushed from mplayer into the\n> linux repository (via a not updated URL[1]).  Is it somehow possible to\n> revert this push if nobody has pushed something since my last pull from\n> the linux repository?\n>\n> (Or can I just copy the .git/objects/ directory over to the repository?)\n>\n> ,----[ .git/remotes/mplayer [1]]\n> | URL: /prj/gitroot/linux\n> | Push: +master:master\n> `----\n>\n> ,----[ git push mplayer ]\n> | updating 'refs/heads/master'\n> |   from 94545baded0bfbabdc30a3a4cb48b3db479dd6ef\n> |   to   9085d919f7954ad629447157f054e55230513936\n> | Generating pack...\n> | Done counting 3240 objects.\n> | Deltifying 3240 objects...\n> |  100% (3240/3240) done\n> | Writing 3240 objects...\n> |  100% (3240/3240) done\n> | Total 3240 (delta 774), reused 0 (delta 0)\n> | refs/heads/master: 94545baded0bfbabdc30a3a4cb48b3db479dd6ef -> 9085d919f7954ad629447157f054e55230513936\n> `----\n\n\nYou can push again to revert your original push, just specifying a\ndifferent ref to push.  Something like this ought to work :\n\ngit push -f mplayer 94545bade:master\n\nwhich will update the remote 'master' branch with commit 94545bade,\nwhich is what it was before your accidental push\n\nJon\n"},{"id":"64931","messageId":"6zmyrdpze7.fsf@odpc25.int.ondemand.co.at","threadId":"11566","inReplyTo":"57518fd10801100531v6f6aef85k4b1b875c6f16aeba@mail.gmail.com","subject":"Re: Revert git push","fromName":"Markus Korber","fromEmail":"korbse@gmx.at","sentAt":"2008-01-10T13:45:52Z","receivedAt":"2008-01-10T13:45:52Z","isPatch":false,"sender":{"key":"korbse@gmx.at","avatar":null},"body":"Thus spake Jonathan del Strother:\n\n> On Jan 10, 2008 1:15 PM, Markus Korber <korbse@gmx.at> wrote:\n>\n>> I've got two local git repositories, linux and mplayer, where I push to\n>> from a local directory.  Now I accidentally pushed from mplayer into the\n>> linux repository (via a not updated URL[1]).  Is it somehow possible to\n>> revert this push if nobody has pushed something since my last pull from\n>> the linux repository?\n>\n> You can push again to revert your original push, just specifying a\n> different ref to push.  Something like this ought to work :\n>\n> git push -f mplayer 94545bade:master\n>\n> which will update the remote 'master' branch with commit 94545bade,\n> which is what it was before your accidental push\n\nUnfortunately this gives:\n\n,----[ git push -f mplayer 94545bade:master  ]\n| error: src refspec 94545bade does not match any.\n| fatal: The remote end hung up unexpectedly\n| error: failed to push to '/prj/gitroot/linux'\n`----\n\n,----[ git --version ]\n| git version 1.5.3.1\n`----\n\nRegards,\nMarkus Korber\n"},{"id":"64932","messageId":"478627E2.4060808@viscovery.net","threadId":"11566","inReplyTo":"6zve61q0t3.fsf@odpc25.int.ondemand.co.at","subject":"Re: Revert git push","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2008-01-10T14:12:50Z","receivedAt":"2008-01-10T14:12:50Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Markus Korber schrieb:\n> Hi,\n> \n> I've got two local git repositories, linux and mplayer, where I push to\n> from a local directory.  Now I accidentally pushed from mplayer into the\n> linux repository (via a not updated URL[1]).  Is it somehow possible to\n> revert this push if nobody has pushed something since my last pull from\n> the linux repository?\n\nSure.\n\n$ cd /the/linux/repo\n$ git checkout 94545baded\n$ git branch -f master 94545baded\n$ git checkout master\n\nOmit the two checkouts if the repo is bare or if it did not have 'master'\nchecked out.\n\n-- Hannes\n"},{"id":"65310","messageId":"6z7iicpu6c.fsf@odpc25.int.ondemand.co.at","threadId":"11566","inReplyTo":"478627E2.4060808@viscovery.net","subject":"Re: Revert git push","fromName":"Markus Korber","fromEmail":"korbse@gmx.at","sentAt":"2008-01-14T10:39:55Z","receivedAt":"2008-01-14T10:39:55Z","isPatch":false,"sender":{"key":"korbse@gmx.at","avatar":null},"body":"Thus spake Johannes Sixt:\n\n> Markus Korber schrieb:\n>\n>> revert this push if nobody has pushed something since my last pull from\n>> the linux repository?\n>\n> $ cd /the/linux/repo\n> $ git checkout 94545baded\n> $ git branch -f master 94545baded\n> $ git checkout master\n>\n> Omit the two checkouts if the repo is bare or if it did not have 'master'\n> checked out.\n\nThanks a lot, that worked like a charm.\n\nRegards,\nMarkus Korber\n"}]}