You are not logged in.

#1 2014-09-26 20:51:44

alphaniner
Member
From: Ancapistan
Registered: 2010-07-12
Posts: 2,810

[Solved/PEBKAC] Learning to git disaster

Long story short:

$ git add foo
$ git rm -r --cache foo/bar

Noticing that my .git folder was still rather large (foo/bar contained 90%) I ran

$ git clean -fd

thinking that would clean the .git folder. Apparently I was mistaken and 'clean' is actually a synonym for 'destroy_my_data', because my .git folder is still bloated but my data is gone.

I guess all the files in '.' that were never tracked are gone for good, but is there some way to restore foo/bar from the bloated .git folder?

Last edited by alphaniner (2014-09-29 13:04:58)


But whether the Constitution really be one thing, or another, this much is certain - that it has either authorized such a government as we have had, or has been powerless to prevent it. In either case, it is unfit to exist.
-Lysander Spooner

Offline

#2 2014-09-26 21:09:49

boccobrock
Member
From: Salt Lake City, UT
Registered: 2014-05-02
Posts: 6

Re: [Solved/PEBKAC] Learning to git disaster

Try this:

$ git fsck --lost-found

This will hopefully mention a dangling blob.
Then see what is in your .git/lost-found/other/
It may have hashes for filenames but worth a try.

Offline

#3 2014-09-26 21:18:41

alphaniner
Member
From: Ancapistan
Registered: 2010-07-12
Posts: 2,810

Re: [Solved/PEBKAC] Learning to git disaster

Thanks, that's good to know. As it turns out though, I had actually backed up foo/bar, because that 'rm' command worried me. So I got that back easily.

But 'clean' sounds so innocuous that I didn't backup the untracked folders, all of which were updated quite a bit since the last full backup... :'(


But whether the Constitution really be one thing, or another, this much is certain - that it has either authorized such a government as we have had, or has been powerless to prevent it. In either case, it is unfit to exist.
-Lysander Spooner

Offline

#4 2014-09-29 11:16:14

frostbittenking
Member
Registered: 2013-05-01
Posts: 67

Re: [Solved/PEBKAC] Learning to git disaster

That you didn't even bother to read the man page or the git tutorial eg git-scm.com, is beyond me.

Offline

#5 2014-09-29 13:03:51

alphaniner
Member
From: Ancapistan
Registered: 2010-07-12
Posts: 2,810

Re: [Solved/PEBKAC] Learning to git disaster

That you felt the need to share that is beyond me.


But whether the Constitution really be one thing, or another, this much is certain - that it has either authorized such a government as we have had, or has been powerless to prevent it. In either case, it is unfit to exist.
-Lysander Spooner

Offline

#6 2014-09-29 13:51:26

progandy
Member
Registered: 2012-05-17
Posts: 5,322

Re: [Solved/PEBKAC] Learning to git disaster

alphaniner wrote:

But 'clean' sounds so innocuous that I didn't backup the untracked folders, all of which were updated quite a bit since the last full backup... :'(

I always have extundelete installed as one more step in my backup net. When I notice I removed a file that is not in the backup yet, I unmount my partition or remount it readonly, then I try to recover the file(s). Since you have moved a lot of data since the removal, it might not help you anymore.

Last edited by progandy (2014-09-29 13:52:21)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' | alias ENGLISH='LANG=C.UTF-8 ' |

Offline

Board footer

Powered by FluxBB