[gmx-developers] accidental commit to gromacs public repository?

Mark Abraham Mark.Abraham at anu.edu.au
Tue Jan 5 02:23:35 CET 2010


Michael Shirts wrote:
> Hi all-
> 
> I accidentally ran a "git push origin" to the public repository
> instead of a "git push gromacs_mrs" (my 'private' public repository),
> and after a couple of hours of googling, am still not sufficiently
> certain I know to revert a push to a public repository without messing
> everyone up that I'm willing to try it.  The European developers seem
> to have gone to bed, so if anyone else feels confident in their
> knowledge of git, please let me know!  Or alternately, you might want
> to avoid pulling any changes tonight.  Apologies for the
> inconvenience!

You probably can't do anything. One can change pretty much anything 
before any other repo has pulled from the one to which you committed 
erroneously. However once anybody has pulled, your "undo" changes risk 
trashing their repository.

"git revert" is used in this case to record a new commit to undo cleanly 
the effect of the erroneous one. You can experiment with its usage by 
pushing the error to gromacs_mrs, reverting on your working repo, and 
pushing again to gromacs_mrs.

One workflow that helps avoid this is to have gromacs_mrs a clone of the 
official repo, and you clone gromacs_mrs to your working repo. origin 
points to the clone origin, not the ancestor. Now all you need to do is 
take care you know which repo you're in when you "git push origin" (not 
too hard!). Alternatively, you can edit .git/config to change the label 
of origin wrt gromacs_mrs to something that you won't type unthinkingly 
- like "gromacscentralmaster" etc.

Mark



More information about the gromacs.org_gmx-developers mailing list