[Prev] Thread [Next]  |  [Prev] Date [Next]

Re: [mythtv] GIT reverts accidentally committed Paul Gardiner Wed Feb 22 03:00:39 2012

On 22/02/2012 00:22, Nigel Pearson wrote:
>> You can simply apply apply a reverse diff of all those 5 changes and
>> that will be the end of it.
> Yes. I tried a revert HEAD, but then git wouldn't let me
> revert HEAD^ (the merge). So I tried it in the opposite order
> (HEAD^^^^ first), but the commit messages like:
> (Revert of "Revert of "a5fcdea9779... don't let stash cause failures" ")
> were not my friend late last night.

For another time, there's a dead easy way to fix this sort of thing
using gitk:

gitk will show you the list of commits ending, at the top, with the
current position of the branch you are on (presumably master). The
good state you are trying to restore to is 5 lines down.

Right click on the position of the good state, and select "reset",
and then in the pop up dialog pick "Hard".

Then Right click back at the top where master was before the reset.
select "reset" again, but this time leave the type of reset as

Now you have in your working copy the changes that are needed to
put things right. Commit them and push. No need for --force.
Never use --force to a public repo unless all other people with
write access have agreed and are ready.

You can do all that from the command line, but it's so easy and
quick with gitk.

mythtv-dev mailing list