Re: [RFC] git reset --recover
- From
- Santi Béjar <sbejar@gmail.com>
- Date
- Mar 3, 2008, 15:13 UTC
- Message-ID
- <8aa486160803030713r7bdcf825sf994cbb20f096ccd@mail.gmail.com>
- In-Reply-To
- <46dff0320803030659j2fa0325lf9c88b915ddb70da@mail.gmail.com>
On Mon, Mar 3, 2008 at 3:59 PM, Ping Yin <pkufranky@gmail.com> wrote:
Show 27 quoted lines
> 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