* [RFC] git reset --recover
@ 2008-03-03 14:59 Ping Yin
2008-03-03 15:13 ` Santi Béjar
2008-03-03 17:02 ` Charles Bailey
0 siblings, 2 replies; 7+ messages in thread
From: Ping Yin @ 2008-03-03 14:59 UTC (permalink / raw)
To: Git Mailing List
Today i use git reset carelessly and lose all my changes!
To remind other people not do the same wrong thing, i share my
experience and propose a new option to avoid this happens again.
------------------------------------
foo
.git
bar
file1
file2
------------------------------------
In the direcotry structure above, i want to make bar as a repository
(which hasn't yet been tracked by foo repository). I should have done
this as follows
-------------------------------------------
cd bar
git init
git add
------------------------------------------
but i fogot to type "git init" which results that file1 and file2 are
added to index of foo repository. I tried to revert the operation
using "git reset". And the tragedy happened at that time because i
made so fatal a mistake that i typed "git reset --hard". And i lost
all my files in bar dir!
So, can we introduce a --recover option for "git reset" to save the
foolish or careless people like me?
--
Ping Yin
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFC] git reset --recover
2008-03-03 14:59 [RFC] git reset --recover Ping Yin
@ 2008-03-03 15:13 ` Santi Béjar
2008-03-03 16:47 ` Ping Yin
2008-03-03 17:02 ` Charles Bailey
1 sibling, 1 reply; 7+ messages in thread
From: Santi Béjar @ 2008-03-03 15:13 UTC (permalink / raw)
To: Ping Yin; +Cc: Git Mailing List
On Mon, Mar 3, 2008 at 3:59 PM, Ping Yin <pkufranky@gmail.com> wrote:
> Today i use git reset carelessly and lose all my changes!
>
> To remind other people not do the same wrong thing, i share my
> experience and propose a new option to avoid this happens again.
> ------------------------------------
> foo
> .git
> bar
> file1
> file2
> ------------------------------------
>
> In the direcotry structure above, i want to make bar as a repository
> (which hasn't yet been tracked by foo repository). I should have done
> this as follows
>
> -------------------------------------------
> cd bar
> git init
> git add
> ------------------------------------------
>
> but i fogot to type "git init" which results that file1 and file2 are
> added to index of foo repository. I tried to revert the operation
> using "git reset". And the tragedy happened at that time because i
> made so fatal a mistake that i typed "git reset --hard". And i lost
> all my files in bar dir!
"git reset" was sufficient.
>
> So, can we introduce a --recover option for "git reset" to save the
> foolish or careless people like me?
Another possibility would be to not delete a file that is absent in
both the old and new HEAD, even if it was in the index.
Santi
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFC] git reset --recover
2008-03-03 15:13 ` Santi Béjar
@ 2008-03-03 16:47 ` Ping Yin
0 siblings, 0 replies; 7+ messages in thread
From: Ping Yin @ 2008-03-03 16:47 UTC (permalink / raw)
To: Santi Béjar; +Cc: Git Mailing List
On Mon, Mar 3, 2008 at 11:13 PM, Santi Béjar <sbejar@gmail.com> wrote:
> On Mon, Mar 3, 2008 at 3:59 PM, Ping Yin <pkufranky@gmail.com> wrote:
> > Today i use git reset carelessly and lose all my changes!
> >
> >
> > but i fogot to type "git init" which results that file1 and file2 are
> > added to index of foo repository. I tried to revert the operation
> > using "git reset". And the tragedy happened at that time because i
> > made so fatal a mistake that i typed "git reset --hard". And i lost
> > all my files in bar dir!
>
> "git reset" was sufficient.
>
I know about this, but i was just too careless.
>
> >
> > So, can we introduce a --recover option for "git reset" to save the
> > foolish or careless people like me?
>
> Another possibility would be to not delete a file that is absent in
> both the old and new HEAD, even if it was in the index.
>
Sounds interesting.
> Santi
>
--
Ping Yin
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFC] git reset --recover
2008-03-03 14:59 [RFC] git reset --recover Ping Yin
2008-03-03 15:13 ` Santi Béjar
@ 2008-03-03 17:02 ` Charles Bailey
2008-03-04 5:21 ` Ping Yin
1 sibling, 1 reply; 7+ messages in thread
From: Charles Bailey @ 2008-03-03 17:02 UTC (permalink / raw)
To: Ping Yin; +Cc: Git Mailing List
On Mon, Mar 03, 2008 at 10:59:14PM +0800, Ping Yin wrote:
>
> but i fogot to type "git init" which results that file1 and file2 are
> added to index of foo repository. I tried to revert the operation
> using "git reset". And the tragedy happened at that time because i
> made so fatal a mistake that i typed "git reset --hard". And i lost
> all my files in bar dir!
If they've been added to the index then the objects should be in your
git repository, it's just that it may be hard to find them.
Does 'git fsck' report some dangling blobs? If so (some of) them
should be the content of your missing files.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFC] git reset --recover
2008-03-03 17:02 ` Charles Bailey
@ 2008-03-04 5:21 ` Ping Yin
2008-03-04 7:42 ` Jay Soffian
0 siblings, 1 reply; 7+ messages in thread
From: Ping Yin @ 2008-03-04 5:21 UTC (permalink / raw)
To: Charles Bailey; +Cc: Git Mailing List
On Tue, Mar 4, 2008 at 1:02 AM, Charles Bailey <charles@hashpling.org> wrote:
> On Mon, Mar 03, 2008 at 10:59:14PM +0800, Ping Yin wrote:
> >
>
> If they've been added to the index then the objects should be in your
> git repository, it's just that it may be hard to find them.
>
> Does 'git fsck' report some dangling blobs? If so (some of) them
> should be the content of your missing files.
>
Good news. So can "--recover" help me find the lost blobs?
--
Ping Yin
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFC] git reset --recover
2008-03-04 5:21 ` Ping Yin
@ 2008-03-04 7:42 ` Jay Soffian
2008-03-04 8:22 ` Ping Yin
0 siblings, 1 reply; 7+ messages in thread
From: Jay Soffian @ 2008-03-04 7:42 UTC (permalink / raw)
To: Ping Yin; +Cc: Charles Bailey, Git Mailing List
On Tue, Mar 4, 2008 at 12:21 AM, Ping Yin <pkufranky@gmail.com> wrote:
> On Tue, Mar 4, 2008 at 1:02 AM, Charles Bailey <charles@hashpling.org> wrote:
> >
> > Does 'git fsck' report some dangling blobs? If so (some of) them
> > should be the content of your missing files.
> >
> Good news. So can "--recover" help me find the lost blobs?
git fsck --lost-found. Look under .git/lost-found/other for your blobs.
Anything that's not 41 bytes is a file.
j.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFC] git reset --recover
2008-03-04 7:42 ` Jay Soffian
@ 2008-03-04 8:22 ` Ping Yin
0 siblings, 0 replies; 7+ messages in thread
From: Ping Yin @ 2008-03-04 8:22 UTC (permalink / raw)
To: Jay Soffian; +Cc: Charles Bailey, Git Mailing List
On Tue, Mar 4, 2008 at 3:42 PM, Jay Soffian <jaysoffian@gmail.com> wrote:
> On Tue, Mar 4, 2008 at 12:21 AM, Ping Yin <pkufranky@gmail.com> wrote:
> > On Tue, Mar 4, 2008 at 1:02 AM, Charles Bailey <charles@hashpling.org> wrote:
> > >
>
> > > Does 'git fsck' report some dangling blobs? If so (some of) them
> > > should be the content of your missing files.
> > >
> > Good news. So can "--recover" help me find the lost blobs?
>
> git fsck --lost-found. Look under .git/lost-found/other for your blobs.
> Anything that's not 41 bytes is a file.
>
Thanks for pointing me that.
> j.
>
--
Ping Yin
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2008-03-04 8:23 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-03 14:59 [RFC] git reset --recover Ping Yin
2008-03-03 15:13 ` Santi Béjar
2008-03-03 16:47 ` Ping Yin
2008-03-03 17:02 ` Charles Bailey
2008-03-04 5:21 ` Ping Yin
2008-03-04 7:42 ` Jay Soffian
2008-03-04 8:22 ` Ping Yin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).