Git ate my homework.

A place for Ogre users to discuss non-Ogre subjects with friends from the community.
Post Reply
User avatar
mkultra333
Gold Sponsor
Gold Sponsor
Posts: 1894
Joined: Sun Mar 08, 2009 5:25 am
x 116

Git ate my homework.

Post by mkultra333 »

Hmm.

Feeling like I wasn't one of the cool kids, I decided to start using a DVCS a few weeks ago instead of zipping/copying each days work. I used tortoisegit.

And it just destroyed 2 weeks worth of work. Vanished into nothing. No doubt due entirely to my own inexperience and pressing the wrong buttons... seems asking it to "clean up" wasn't such a good idea.

This reminds me of why I hate these systems. When they screw up, they don't just destroy todays work. They destroy virtually everything.

Ugh. Groan. Sigh. Screw the cool kids, I'm going back to zip files.
"In theory there is no difference between practice and theory. In practice, there is." - Psychology Textbook.
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: Git ate my homework.

Post by jacmoe »

Mercurial is the answer!
At least it screws up in an elegant fashion when it does, compared to Git. :D
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: Git ate my homework.

Post by jacmoe »

What TortoiseGit is it you're using?
Don't tell me you used clean up before adding files to the repository?
The default for TortoiseGit Clean is to get rid of all files which are not under version control.. :o
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
CABAListic
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 2903
Joined: Thu Jan 18, 2007 2:48 pm
x 58
Contact:

Re: Git ate my homework.

Post by CABAListic »

Really? That is a remarkably bad default...
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: Git ate my homework.

Post by jacmoe »

That's Git in a nutshell. :)
A very fashionable way of shooting yourself in your foot.
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
User avatar
mkultra333
Gold Sponsor
Gold Sponsor
Posts: 1894
Joined: Sun Mar 08, 2009 5:25 am
x 116

Re: Git ate my homework.

Post by mkultra333 »

I was already considering giving Mercurial a try. That, plus I'll still keep a weekly zip backup just in case.

The other thing that makes my mood dark is that Git just deleted the files instead of putting them in the recycle bin. That's very impolite. And I don't have any "super undelete" software installed. Catch 22 now is that if I install a file recovery program, the install will probably write over the top of the very files I want to recover.

Oh well. It was a shader I added cube reflection mapping to (complete with texture normals distorting the cubemap). Hopefully recreating it will be much faster than the orginal work, since I know the right way to proceed instead of having to work it out.
"In theory there is no difference between practice and theory. In practice, there is." - Psychology Textbook.
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: Git ate my homework.

Post by jacmoe »

Ouch.. :?

Whatever the DVCS, always clone from a pristine copy before doing any operations on the repository.
No need to mess around with zips.
A clone is so cheap. :)
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
User avatar
stoneCold
OGRE Expert User
OGRE Expert User
Posts: 867
Joined: Fri Oct 01, 2004 9:13 pm
Location: Carinthia, Austria
x 1

Re: Git ate my homework.

Post by stoneCold »

jacmoe wrote:A very fashionable way of shooting yourself in your foot.
Tried git myself some weeks ago, and this sentence is so true.
If you're after DVCS's, better use Mercurial instead :wink:
(also, I have been using TortoiseHG for some weeks now, and it's quite similar to it's svn counterpart, once you get used to push&pull)
User avatar
mkultra333
Gold Sponsor
Gold Sponsor
Posts: 1894
Joined: Sun Mar 08, 2009 5:25 am
x 116

Re: Git ate my homework.

Post by mkultra333 »

On the plus side, it only took me half a day to recreate the shader. It's amazing how much faster programming is when you know all the right choices in advance.

And it was all my own fault, I'm sure, for being a git n00b pressing buttons he shouldn't have. Still, it could have been a little friendlier about the whole thing. Now to give Mercurial a spin.
"In theory there is no difference between practice and theory. In practice, there is." - Psychology Textbook.
reptor
Ogre Magi
Posts: 1120
Joined: Wed Nov 15, 2006 7:41 pm
Location: Finland
x 5

Re: Git ate my homework.

Post by reptor »

Yeah I agree - in fact your code is probably better now :)

I've been through the same sort of thing myself. I wrote "rm * .extension" on Linux and it deleted all of my files from that directory! There was a bloody space after the asterisk! Oh my holy cow how easy that mistake is to make.

You could think the tool would be smart-enough to notice that input cannot be right, but no, it just silently proceeds to delete all files. Yeah, because "rm *" is valid syntax! It doesn't matter to the tool that after that there is some relevant information that is written wrong. Perhaps a safety net of some sort could be useful with this "rm *"... :)

And guess what - I recovered some of the content of the files. I don't remember the exact process or the names of the tools, but I used a tool that reads directly from the disk partition and it was like the whole partition was one big file. I remembered some keywords from the files so I could search for those from the partition and ask it to give me back +-100 lines (or whatever) from where it finds the keyword. It of course resulted in some garbage in the files but a good amount of the content was recovered with this method.
User avatar
nikki
Old One
Posts: 2730
Joined: Sat Sep 17, 2005 10:08 am
Location: San Francisco
x 13
Contact:

Re: Git ate my homework.

Post by nikki »

Seriously? The first time I used git it worked wonders. For Windows, just get msysgit and use 'Git bash here...'. That's awesome. You get 'vim' too. 8)

Anyway, you can probably retreive your files if you use git fsck and search in the trees. I made a similar mistake once (did something really stupid), but I could fix it using fsck.

Maybe the TortoiseGit GUI has non-obvious names for buttons. It should've asked when you did the 'clean' thing. :) I'd say use msysgit, or stick to the command line.
Last edited by nikki on Tue Nov 03, 2009 1:41 pm, edited 1 time in total.
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: Git ate my homework.

Post by jacmoe »

Hehe! :D
I just *knew* it would a matter of time before you showed up with Git and Vim in one sentence! :)
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
User avatar
nikki
Old One
Posts: 2730
Joined: Sat Sep 17, 2005 10:08 am
Location: San Francisco
x 13
Contact:

Re: Git ate my homework.

Post by nikki »

Well, on the CLI, 'git clean' wouldn't do anything without the '-f' (force) option, or -n (list files it would delete).

Why did you run clean up anyway? :P
User avatar
mkultra333
Gold Sponsor
Gold Sponsor
Posts: 1894
Joined: Sun Mar 08, 2009 5:25 am
x 116

Re: Git ate my homework.

Post by mkultra333 »

Hey, if your just going to tell me I did the wrong thing, I can assure you I already know that. ;)

I did try some file recovery but my files were gone, probably overwritten during my initial attempts to get git to undo whatever horrible thing it had done (or I had asked it to do without understanding.)

But I admit, my faith in Git is gone for the moment. I'm just not up for this kind of complex software that so brutally punishes any n00b errors. Sure, I want something better than zipping files all the time, but I have to be confident that it won't undergo some horrendous failure too, even if it is due to my own stupidity. As to why I was cleaning up, somehow I managed to lose the head and end up with this sort of headless git monster thing. I thought perhaps "clean up" might fix things. And at worst I didn't think it would destroy things in an unfixable manner. After all, the point of version control is that you can always go backwards to when things were working...

Don't worry, I'm a little wiser now. But if I have to read the entire Git manual, plus Tortoise Git manual, plus SVN manual (since every tute on git seems to assume you're totally familiar with how CVS or SVN work) then I'm going elsewhere to find something more intuitive.
"In theory there is no difference between practice and theory. In practice, there is." - Psychology Textbook.
SRabbelier
Gnoblar
Posts: 1
Joined: Tue Nov 03, 2009 4:31 pm

Re: Git ate my homework.

Post by SRabbelier »

full disclosure: I only registered to post this

I don't think it's fair to blame git for TortoiseGit's failures, TortoiseGit is by no means "the official git gui interace" (that would be the somewhat ugly duckling git-gui). It is being hacked on by Frank Li and has received little love from core git developers. If you were using the git commandline interace to do the same thing ('git clean'), it would have looked something like this instead:

Code: Select all

$ git clean
fatal: clean.requireForce not set and -n or -f not given; refusing to clean
From the git-clean man page:

Code: Select all

       -f
           If the git configuration specifies clean.requireForce as true, git-clean will refuse to run unless given -f or -n.

       -n, --dry-run
           Don´t actually remove anything, just show what would be done.
So git would not have removed your _untracked files_ unless you explicitly told it to.

Now, another thing, the only thing 'git clean' does (as said) is remove untracked files, from your message I get the impression it deleted 2 weeks worth of work, which seems to be another thing entirely. Unless the files it deleted were indeed untracked, I recommend that you join #git and ask for help in recovering your files, it might be that 'git reflog' and/or 'git fsck --lost-found' can help you recover your work.
willdye
Gnoblar
Posts: 1
Joined: Tue Nov 03, 2009 4:22 pm

Re: Git ate my homework.

Post by willdye »

I'm just learning Git myself. So far I love it, but I agree that it's not as user-friendly as I'd like. Well, it was designed by Linus Torvalds, after all, so it shouldn't surprise me that it's another "Hole Hawg" device. See http://steve-parker.org/articles/others ... hawg.shtml if you haven't read the Hole Hawg story yet. Anybody who uses or wants to try out Linux would do well to know that tale.

I use backups and un-delete systems which are entirely separate from Git, but maybe what I really want is a file system that does version control, backups, undelete, compression, copy-on-write, and so on. I also want the file system to be very aware of the difference between irreplaceable data that I've entered myself, and data that's just one of a several copies of something made by someone else. Maybe someday we'll have a filesystem that combines the best of ZFS http://en.wikipedia.org/wiki/ZFS, the best of Git, and the best of a few other things. Then again, several decades ago people tried to make a sort of ultimate hypertext engine which did all those things. It was called Project Xanadu http://en.wikipedia.org/wiki/Project_Xanadu, it was started in 1960, and they're still working on it. And you thought that YOU were behind schedule...

In the meantime, I'm using Git with a backup system, not as a backup system. Sorry about your data loss. I'm glad that you recovered quickly.

--Will
William L. Dye ("willdye")
Software Enginerd
Lincoln, Nebraska (USA)
Post Reply