Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: MythTV: Dev

GIT reverts accidentally committed

 

 

MythTV dev RSS feed   Index | Next | Previous | View Threaded


nigel at ind

Feb 21, 2012, 3:48 AM

Post #1 of 18 (1106 views)
Permalink
GIT reverts accidentally committed

I had a problem earlier today with some commits against
non-HEAD of master. I though I had reset and reverted locally,
but a commit & push tonight did some "damage."

Is it possible to destroy those 5 pushes to packaging/master?

--
Nigel Pearson, nigel [at] ind|"Reality is that which, |
Telstra Net. Eng., Sydney, Australia | when you stop believing |
Office: 9202 3900 Fax: 9212 6348 | in it, doesn't go away."|
Mobile: 0408 664435 Home: 9792 6998 | Philip K. Dick - 'Valis'|

_______________________________________________
mythtv-dev mailing list
mythtv-dev [at] mythtv
http://www.mythtv.org/mailman/listinfo/mythtv-dev


jyavenard at gmail

Feb 21, 2012, 3:53 AM

Post #2 of 18 (1080 views)
Permalink
Re: GIT reverts accidentally committed [In reply to]

On 21 February 2012 22:48, Nigel Pearson <nigel [at] ind> wrote:
>
> I had a problem earlier today with some commits against
> non-HEAD of master. I though I had reset and reverted locally,
> but a commit & push tonight did some "damage."
>
> Is it possible to destroy those 5 pushes to packaging/master?

did you use --force or not?

If not, simply revert the changes and commit again..

I can do it for you if you want
_______________________________________________
mythtv-dev mailing list
mythtv-dev [at] mythtv
http://www.mythtv.org/mailman/listinfo/mythtv-dev


jyavenard at gmail

Feb 21, 2012, 3:54 AM

Post #3 of 18 (1086 views)
Permalink
Re: GIT reverts accidentally committed [In reply to]

Hi

On 21 February 2012 22:53, Jean-Yves Avenard <jyavenard [at] gmail> wrote:
>> I had a problem earlier today with some commits against
>> non-HEAD of master. I though I had reset and reverted locally,
>> but a commit & push tonight did some "damage."
>>
>> Is it possible to destroy those 5 pushes to packaging/master?

Are you sure you just didn't commit to a branch or something else?

I don't see any commit by you on master.
_______________________________________________
mythtv-dev mailing list
mythtv-dev [at] mythtv
http://www.mythtv.org/mailman/listinfo/mythtv-dev


jyavenard at gmail

Feb 21, 2012, 3:56 AM

Post #4 of 18 (1087 views)
Permalink
Re: GIT reverts accidentally committed [In reply to]

On 21 February 2012 22:54, Jean-Yves Avenard <jyavenard [at] gmail> wrote:

> I don't see any commit by you on master.

sorry, you did so in packaging ...
_______________________________________________
mythtv-dev mailing list
mythtv-dev [at] mythtv
http://www.mythtv.org/mailman/listinfo/mythtv-dev


mtdean at thirdcontact

Feb 21, 2012, 12:59 PM

Post #5 of 18 (1071 views)
Permalink
Re: GIT reverts accidentally committed [In reply to]

On 02/21/2012 06:48 AM, Nigel Pearson wrote:
> I had a problem earlier today with some commits against
> non-HEAD of master. I though I had reset and reverted locally,
> but a commit& push tonight did some "damage."

Can't help with what to do next, but, you may want to run:

git config --local --add push.default tracking

which modifies your local repo to tell it to only push the changes on
the current branch to upstream. From man git-config:

push.default
Defines the action git push should take if no refspec is given on
the command line, no refspec is configured in the remote, and no
refspec is implied by any of the options given on the command line.
Possible values are:

* nothing - do not push anything.

* matching - push all matching branches. All branches having the
same name in both ends are considered to be matching. This is
the default.

* tracking - push the current branch to its upstream branch.

* current - push the current branch to a branch of the same name.

Mike

_______________________________________________
mythtv-dev mailing list
mythtv-dev [at] mythtv
http://www.mythtv.org/mailman/listinfo/mythtv-dev


nigel at ind

Feb 21, 2012, 2:40 PM

Post #6 of 18 (1066 views)
Permalink
Re: GIT reverts accidentally committed [In reply to]

On 21/02/2012, at 10:53 PM, Jean-Yves Avenard wrote:

> On 21 February 2012 22:48, Nigel Pearson <nigel [at] ind> wrote:
>>
>> I had a problem earlier today with some commits against
>> non-HEAD of master. I though I had reset and reverted locally,
>> but a commit & push tonight did some "damage."
>>
>> Is it possible to destroy those 5 pushes to packaging/master?
>
> did you use --force or not?


Probably yes (on a git reset), but who can remember -
that was a day ago in a very busy shell :-(



> If not, simply revert the changes and commit again..

I can revert HEAD^^, which would commit a revert of a revert,
and I think get the tree back to health, bit it would be so
much tidier if these five commits could be totally destroyed.

bb072b558b37eb34dc929f0b9f59d46877e4d6e2 Commit against non-HEAD
6cfde9f7bb12ef32c7f235f61de75791b8e81ce6 Revert of that

7e1be0f1fffedc9a4354c995003dad8259dba813 Accidental revert of something else
95dace6eda047470eeae2dfd1bb2d4c02ad30acf Merge of those to HEAD

30acaf3a9c850f8adbaefd14acc15b51b44fdf92 Commit against HEAD




so we could start clean, and I could just do one commit instead.


--
Nigel Pearson, nigel [at] ind| 4 8 |
Telstra Net. Eng., Sydney, Australia | 15 16 |
Office: 9202 3900 Fax: 9212 6348 | 23 42 |
Mobile: 0408 664435 Home: 9792 6998 | Lost |




_______________________________________________
mythtv-dev mailing list
mythtv-dev [at] mythtv
http://www.mythtv.org/mailman/listinfo/mythtv-dev


nigel at ind

Feb 21, 2012, 3:15 PM

Post #7 of 18 (1065 views)
Permalink
Re: GIT reverts accidentally committed [In reply to]

I was trying to do:

git push origin a5fcdea9779f8ad1821ee741fe99c9032c2c51a6

but it failed for some reason.




Thankfully, this dangerous sequence seemed to do the trick:


% cd ..
% rm -fr packaging
% git clone git [at] github:MythTV/packaging.git
% cd packaging
% git reset --hard a5fcdea9779f8ad1821ee741fe99c9032c2c51a6
HEAD is now at a5fcdea don't let stash cause failures
% git push -f
Connected to http-gw.tcif.telstra.com.au:8080
Starting tunnel
Total 0 (delta 0), reused 0 (delta 0)
Tunnel closed on signal 1
In closeall
To git [at] github:MythTV/packaging.git
+ 30acaf3...a5fcdea master -> master (forced update)
In closeall
%



--
Nigel Pearson, nigel [at] ind|
Telstra Net. Eng., Sydney, Australia |
Office: 9202 3900 Fax: 9212 6348 |
Mobile: 0408 664435 Home: 9792 6998 |

_______________________________________________
mythtv-dev mailing list
mythtv-dev [at] mythtv
http://www.mythtv.org/mailman/listinfo/mythtv-dev


gjhurlbu at gmail

Feb 21, 2012, 3:35 PM

Post #8 of 18 (1067 views)
Permalink
Re: GIT reverts accidentally committed [In reply to]

On Tue, Feb 21, 2012 at 3:15 PM, Nigel Pearson <nigel [at] ind> wrote:
> % cd ..
> % rm -fr packaging
> % git clone git [at] github:MythTV/packaging.git
> % cd packaging
> % git reset --hard a5fcdea9779f8ad1821ee741fe99c9032c2c51a6
> HEAD is now at a5fcdea don't let stash cause failures
> % git push -f
> Connected to http-gw.tcif.telstra.com.au:8080
> Starting tunnel
> Total 0 (delta 0), reused 0 (delta 0)
> Tunnel closed on signal 1
> In closeall
> To git [at] github:MythTV/packaging.git
>  + 30acaf3...a5fcdea master -> master (forced update)
> In closeall
> %


GAH! This is the way to clean it up, yes, but now you have buggered
up everyone who has downloaded with your errant changes in there.
This is why we never rewind unless we need to.

I guess we'll deal with any fallout if it happens :)
_______________________________________________
mythtv-dev mailing list
mythtv-dev [at] mythtv
http://www.mythtv.org/mailman/listinfo/mythtv-dev


nigel at ind

Feb 21, 2012, 3:52 PM

Post #9 of 18 (1064 views)
Permalink
Re: GIT reverts accidentally committed [In reply to]

>> % git reset --hard a5fcdea9779f8ad1821ee741fe99c9032c2c51a6
>> HEAD is now at a5fcdea don't let stash cause failures
>> % git push -f
...
>> To git [at] github:MythTV/packaging.git
>> + 30acaf3...a5fcdea master -> master (forced update)
>
> GAH! This is the way to clean it up, yes, but now you have buggered
> up everyone who has downloaded with your errant changes in there.


Oops. Do "git pull"s now fail?

(GitHub still has the SHAs in its database:
https://github.com/MythTV/packaging/commit/30acaf3a9
and the parent, grandparents, etc. are still linked,
so I was hoping there would be minimal damage.)




But yes, `twas a bit nasty. I just wanted those commits
out of the HEAD history as fast as possible.


(Too proud - didn't want my name attached to rubbish commits?)


--
Nigel Pearson, nigel [at] ind|"In this city I confess.
Telstra Net. Eng., Sydney, Australia | god is mammon, more is less.
Office: 9202 3900 Fax: 9212 6348 | Off like lemmings at the gun!
Mobile: 0408 664435 Home: 9792 6998 | I know better, still I run"

_______________________________________________
mythtv-dev mailing list
mythtv-dev [at] mythtv
http://www.mythtv.org/mailman/listinfo/mythtv-dev


jyavenard at gmail

Feb 21, 2012, 3:54 PM

Post #10 of 18 (1060 views)
Permalink
Re: GIT reverts accidentally committed [In reply to]

On 22 February 2012 09:40, Nigel Pearson <nigel [at] ind> wrote:
>> did you use --force or not?
>
>
> Probably yes (on a git reset), but who can remember -
> that was a day ago in a very busy shell :-(

from what I can tell, you didn't use --force.

you haven't buggered anything, you committed 5 changes you didn't want.

This is not the end of the world.

You can simply apply apply a reverse diff of all those 5 changes and
that will be the end of it.

> I can revert HEAD^^, which would commit a revert of a revert,
> and I think get the tree back to health, bit it would be so
> much tidier if these five commits could be totally destroyed.

I disagree about totally removing the 5 commits has if it never
existed. It would bugger the repo for anyone who has updated their
copy.
And it really doesn't matter if your commits are in the history.

It wouldn't be the first time someone committed something only to
reverse it later.
> so we could start clean, and I could just do one commit instead.

as long as no --force are used, I'm okay with anything...
_______________________________________________
mythtv-dev mailing list
mythtv-dev [at] mythtv
http://www.mythtv.org/mailman/listinfo/mythtv-dev


gjhurlbu at gmail

Feb 21, 2012, 4:05 PM

Post #11 of 18 (1060 views)
Permalink
Re: GIT reverts accidentally committed [In reply to]

On Tue, Feb 21, 2012 at 3:54 PM, Jean-Yves Avenard <jyavenard [at] gmail> wrote:
> from what I can tell, you didn't use --force.

He has since :)

Anyways, not to worry. There is some chance that people's repo clones
will be a bit bent by doing that, but it's nothing we can't overcome
easily enough. In particular, if it does get wonky, the thing to do
would be (in the MythTV/packaging repo):

git checkout master
git reset --hard a5fcdea9779
git pull

I think that should just about do it. Not too hard, but not something
we would want to do often :)
_______________________________________________
mythtv-dev mailing list
mythtv-dev [at] mythtv
http://www.mythtv.org/mailman/listinfo/mythtv-dev


jyavenard at gmail

Feb 21, 2012, 4:08 PM

Post #12 of 18 (1056 views)
Permalink
Re: GIT reverts accidentally committed [In reply to]

On 22 February 2012 11:05, Gavin Hurlbut <gjhurlbu [at] gmail> wrote:
> On Tue, Feb 21, 2012 at 3:54 PM, Jean-Yves Avenard <jyavenard [at] gmail> wrote:
>> from what I can tell, you didn't use --force.
>
> He has since :)

unbelievable...

>
> Anyways, not to worry.  There is some chance that people's repo clones
> will be a bit bent by doing that, but it's nothing we can't overcome
> easily enough.  In particular, if it does get wonky, the thing to do
> would be (in the MythTV/packaging repo):
>
> git checkout master
> git reset --hard a5fcdea9779
> git pull
>
> I think that should just about do it.  Not too hard, but not something
> we would want to do often :)

public announcement should be made , that any copy made by people
before today are now fucked up and special care need to be taken.
_______________________________________________
mythtv-dev mailing list
mythtv-dev [at] mythtv
http://www.mythtv.org/mailman/listinfo/mythtv-dev


gjhurlbu at gmail

Feb 21, 2012, 4:11 PM

Post #13 of 18 (1063 views)
Permalink
Re: GIT reverts accidentally committed [In reply to]

On Tue, Feb 21, 2012 at 4:08 PM, Jean-Yves Avenard <jyavenard [at] gmail> wrote:
> public announcement should be made , that any copy made by people
> before today are now fucked up and special care need to be taken.


Let this thread serve as a public announcement :)
_______________________________________________
mythtv-dev mailing list
mythtv-dev [at] mythtv
http://www.mythtv.org/mailman/listinfo/mythtv-dev


nigel at ind

Feb 21, 2012, 4:22 PM

Post #14 of 18 (1058 views)
Permalink
Re: GIT reverts accidentally committed [In reply to]

> 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.




And no, I have never re-written history (modified a commit log?),
although I have appended RCS checkins with "correction" lines,
back when I was a CM, and the devs were particularly insistent.

--
Nigel Pearson, nigel [at] ind|The weak point of |
Telstra Net. Eng., Sydney, Australia | the modern car is |
Office: 9202 3900 Fax: 9212 6348 | the squidgy organic |
Mobile: 0408 664435 Home: 9792 6998 | bit behind the wheel.|

_______________________________________________
mythtv-dev mailing list
mythtv-dev [at] mythtv
http://www.mythtv.org/mailman/listinfo/mythtv-dev


lists at glidos

Feb 22, 2012, 2:33 AM

Post #15 of 18 (1044 views)
Permalink
Re: GIT reverts accidentally committed [In reply to]

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
Mixed.

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.

Cheers,
Paul.
_______________________________________________
mythtv-dev mailing list
mythtv-dev [at] mythtv
http://www.mythtv.org/mailman/listinfo/mythtv-dev


danielk at cuymedia

Feb 22, 2012, 1:38 PM

Post #16 of 18 (1041 views)
Permalink
Re: GIT reverts accidentally committed [In reply to]

On Wed, 2012-02-22 at 10:52 +1100, Nigel Pearson wrote:
> >> % git reset --hard a5fcdea9779f8ad1821ee741fe99c9032c2c51a6
> >> HEAD is now at a5fcdea don't let stash cause failures
> >> % git push -f
> ...
> >> To git [at] github:MythTV/packaging.git
> >> + 30acaf3...a5fcdea master -> master (forced update)
> >
> > GAH! This is the way to clean it up, yes, but now you have buggered
> > up everyone who has downloaded with your errant changes in there.
>
>
> Oops. Do "git pull"s now fail?

Yeah, anyone that pulled the bad change has to manually repair their
repo. The proper thing to do is to just reverse all the changes. As
you found out git revert has problems if there is a merge involved
because it doesn't know which parent tree is 'trunk'; but it is still
possible to create a patch manually. (There is probably some git magic
to tell revert what to do, but I don't know it.)

As a rule you should only get rid of commits completely while they
are still only in your local tree. After that you want to commit
something new to do undo the damage.

-- Daniel

_______________________________________________
mythtv-dev mailing list
mythtv-dev [at] mythtv
http://www.mythtv.org/mailman/listinfo/mythtv-dev


lsorense at csclub

Feb 22, 2012, 1:50 PM

Post #17 of 18 (1037 views)
Permalink
Re: GIT reverts accidentally committed [In reply to]

On Wed, Feb 22, 2012 at 04:38:48PM -0500, Daniel Kristjansson wrote:
> Yeah, anyone that pulled the bad change has to manually repair their
> repo. The proper thing to do is to just reverse all the changes. As
> you found out git revert has problems if there is a merge involved
> because it doesn't know which parent tree is 'trunk'; but it is still
> possible to create a patch manually. (There is probably some git magic
> to tell revert what to do, but I don't know it.)

I believe reverting the merge commit works. It isn't completely obvious
though that one should do that.

> As a rule you should only get rid of commits completely while they
> are still only in your local tree. After that you want to commit
> something new to do undo the damage.

--
Len Sorensen
_______________________________________________
mythtv-dev mailing list
mythtv-dev [at] mythtv
http://www.mythtv.org/mailman/listinfo/mythtv-dev


ijc at hellion

Feb 23, 2012, 3:56 AM

Post #18 of 18 (1024 views)
Permalink
Re: GIT reverts accidentally committed [In reply to]

On Wed, 2012-02-22 at 16:38 -0500, Daniel Kristjansson wrote:
> On Wed, 2012-02-22 at 10:52 +1100, Nigel Pearson wrote:
> > >> % git reset --hard a5fcdea9779f8ad1821ee741fe99c9032c2c51a6
> > >> HEAD is now at a5fcdea don't let stash cause failures
> > >> % git push -f
> > ...
> > >> To git [at] github:MythTV/packaging.git
> > >> + 30acaf3...a5fcdea master -> master (forced update)
> > >
> > > GAH! This is the way to clean it up, yes, but now you have buggered
> > > up everyone who has downloaded with your errant changes in there.
> >
> >
> > Oops. Do "git pull"s now fail?
>
> Yeah, anyone that pulled the bad change has to manually repair their
> repo.

Someone could also repush those commits + the necesary revert and an
appropriate merge if necessary and save everyone else the bother?

Ian.
--
Ian Campbell
Current Noise: Slayer - Threshold

For a light heart lives long.
-- Shakespeare, "Love's Labour's Lost"

_______________________________________________
mythtv-dev mailing list
mythtv-dev [at] mythtv
http://www.mythtv.org/mailman/listinfo/mythtv-dev

MythTV dev RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.