* Revert git push
@ 2008-01-10 13:15 Markus Korber
2008-01-10 13:31 ` Jonathan del Strother
2008-01-10 14:12 ` Johannes Sixt
0 siblings, 2 replies; 5+ messages in thread
From: Markus Korber @ 2008-01-10 13:15 UTC (permalink / raw)
To: git
Hi,
I've got two local git repositories, linux and mplayer, where I push to
from a local directory. Now I accidentally pushed from mplayer into the
linux repository (via a not updated URL[1]). Is it somehow possible to
revert this push if nobody has pushed something since my last pull from
the linux repository?
(Or can I just copy the .git/objects/ directory over to the repository?)
,----[ .git/remotes/mplayer [1]]
| URL: /prj/gitroot/linux
| Push: +master:master
`----
,----[ git push mplayer ]
| updating 'refs/heads/master'
| from 94545baded0bfbabdc30a3a4cb48b3db479dd6ef
| to 9085d919f7954ad629447157f054e55230513936
| Generating pack...
| Done counting 3240 objects.
| Deltifying 3240 objects...
| 100% (3240/3240) done
| Writing 3240 objects...
| 100% (3240/3240) done
| Total 3240 (delta 774), reused 0 (delta 0)
| refs/heads/master: 94545baded0bfbabdc30a3a4cb48b3db479dd6ef -> 9085d919f7954ad629447157f054e55230513936
`----
Regards,
Markus Korber
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Revert git push
2008-01-10 13:15 Revert git push Markus Korber
@ 2008-01-10 13:31 ` Jonathan del Strother
2008-01-10 13:45 ` Markus Korber
2008-01-10 14:12 ` Johannes Sixt
1 sibling, 1 reply; 5+ messages in thread
From: Jonathan del Strother @ 2008-01-10 13:31 UTC (permalink / raw)
To: Markus Korber; +Cc: git
On Jan 10, 2008 1:15 PM, Markus Korber <korbse@gmx.at> wrote:
> Hi,
>
> I've got two local git repositories, linux and mplayer, where I push to
> from a local directory. Now I accidentally pushed from mplayer into the
> linux repository (via a not updated URL[1]). Is it somehow possible to
> revert this push if nobody has pushed something since my last pull from
> the linux repository?
>
> (Or can I just copy the .git/objects/ directory over to the repository?)
>
> ,----[ .git/remotes/mplayer [1]]
> | URL: /prj/gitroot/linux
> | Push: +master:master
> `----
>
> ,----[ git push mplayer ]
> | updating 'refs/heads/master'
> | from 94545baded0bfbabdc30a3a4cb48b3db479dd6ef
> | to 9085d919f7954ad629447157f054e55230513936
> | Generating pack...
> | Done counting 3240 objects.
> | Deltifying 3240 objects...
> | 100% (3240/3240) done
> | Writing 3240 objects...
> | 100% (3240/3240) done
> | Total 3240 (delta 774), reused 0 (delta 0)
> | refs/heads/master: 94545baded0bfbabdc30a3a4cb48b3db479dd6ef -> 9085d919f7954ad629447157f054e55230513936
> `----
You can push again to revert your original push, just specifying a
different ref to push. Something like this ought to work :
git push -f mplayer 94545bade:master
which will update the remote 'master' branch with commit 94545bade,
which is what it was before your accidental push
Jon
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Revert git push
2008-01-10 13:31 ` Jonathan del Strother
@ 2008-01-10 13:45 ` Markus Korber
0 siblings, 0 replies; 5+ messages in thread
From: Markus Korber @ 2008-01-10 13:45 UTC (permalink / raw)
To: Jonathan del Strother; +Cc: git
Thus spake Jonathan del Strother:
> On Jan 10, 2008 1:15 PM, Markus Korber <korbse@gmx.at> wrote:
>
>> I've got two local git repositories, linux and mplayer, where I push to
>> from a local directory. Now I accidentally pushed from mplayer into the
>> linux repository (via a not updated URL[1]). Is it somehow possible to
>> revert this push if nobody has pushed something since my last pull from
>> the linux repository?
>
> You can push again to revert your original push, just specifying a
> different ref to push. Something like this ought to work :
>
> git push -f mplayer 94545bade:master
>
> which will update the remote 'master' branch with commit 94545bade,
> which is what it was before your accidental push
Unfortunately this gives:
,----[ git push -f mplayer 94545bade:master ]
| error: src refspec 94545bade does not match any.
| fatal: The remote end hung up unexpectedly
| error: failed to push to '/prj/gitroot/linux'
`----
,----[ git --version ]
| git version 1.5.3.1
`----
Regards,
Markus Korber
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Revert git push
2008-01-10 13:15 Revert git push Markus Korber
2008-01-10 13:31 ` Jonathan del Strother
@ 2008-01-10 14:12 ` Johannes Sixt
2008-01-14 10:39 ` Markus Korber
1 sibling, 1 reply; 5+ messages in thread
From: Johannes Sixt @ 2008-01-10 14:12 UTC (permalink / raw)
To: Markus Korber; +Cc: git
Markus Korber schrieb:
> Hi,
>
> I've got two local git repositories, linux and mplayer, where I push to
> from a local directory. Now I accidentally pushed from mplayer into the
> linux repository (via a not updated URL[1]). Is it somehow possible to
> revert this push if nobody has pushed something since my last pull from
> the linux repository?
Sure.
$ cd /the/linux/repo
$ git checkout 94545baded
$ git branch -f master 94545baded
$ git checkout master
Omit the two checkouts if the repo is bare or if it did not have 'master'
checked out.
-- Hannes
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Revert git push
2008-01-10 14:12 ` Johannes Sixt
@ 2008-01-14 10:39 ` Markus Korber
0 siblings, 0 replies; 5+ messages in thread
From: Markus Korber @ 2008-01-14 10:39 UTC (permalink / raw)
To: Johannes Sixt; +Cc: git
Thus spake Johannes Sixt:
> Markus Korber schrieb:
>
>> revert this push if nobody has pushed something since my last pull from
>> the linux repository?
>
> $ cd /the/linux/repo
> $ git checkout 94545baded
> $ git branch -f master 94545baded
> $ git checkout master
>
> Omit the two checkouts if the repo is bare or if it did not have 'master'
> checked out.
Thanks a lot, that worked like a charm.
Regards,
Markus Korber
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-01-14 10:40 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-10 13:15 Revert git push Markus Korber
2008-01-10 13:31 ` Jonathan del Strother
2008-01-10 13:45 ` Markus Korber
2008-01-10 14:12 ` Johannes Sixt
2008-01-14 10:39 ` Markus Korber
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).