[gmx-developers] Re: accidental commit to gromacs public repository?
Mark Abraham
Mark.Abraham at anu.edu.au
Tue Jan 5 04:15:02 CET 2010
Michael Shirts wrote:
> That's what I was afraid of!
>
> It seems that there should be some sort of single command that one can
> perform on the public repository to just revert the last commit and
> merge (as can be done with a bad "git pull") as opposed to
> individually reverting all the commits in a local repository, and
> pushing a new single commit with all the edits. Isn't the whole point
> of reversion control to be able to quickly recover from errors?
The obvious way to permit a repository to undo is for the repo to
contain a history of all operations performed on it. So when someone
pulls after the erroneous commit, and then you undo that commit, and
someone else commits more work, that person who pulled can pull again,
and receive the undo operation and the subsequent commits. This
mechanism exists - you just make a new commit that does the undo!
Creating a hidden layer of recorded operations that do not correspond to
commit events sounds like lots of work and trouble for the gain of being
able to undo without mildly polluting the commit message space. It seems
relatively reasonable for a "central master repository" model as we are
using for GROMACS. However such a method sounds like a recipe for
disaster for the general case of a *distributed* version control system.
Mark
> I've now tried individually going through and deleting all my
> revisions, but haven't been able to find a combination of
> specification of merge mainlines that actually returns the repository
> to the condition it was right.
>
> At least the code should only change results with keywords introduced
> after 4.0, so it won't be a total disaster for me to address
> individual changes.
>
> grr . . . .
>
> ------------------------------------------------------
> 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