All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Changsheng Jiang" <jiangzuoyan@gmail.com>
To: "Eric Raible" <raible@gmail.com>
Cc: "Git Mailing List" <git@vger.kernel.org>
Subject: Re: RFC: perhaps a "new file" should not be deleted by "git reset --hard"
Date: Thu, 11 Sep 2008 14:05:49 +0800	[thread overview]
Message-ID: <eafc0afe0809102305u6de85ef3ib2c08004dea8d6f9@mail.gmail.com> (raw)
In-Reply-To: <279b37b20809101946k309ad113neb7d051f1c6c410e@mail.gmail.com>

I don't know what version of you git, my git with version 1.5.4.5
doesn't delete the file file42 after git-reset.

BTW, if you added the file42 to .gitignore, why git-status still
reported "new file" file42"?

Yours sincerely,
Changsheng Jiang
pubkey: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x40C37374



On Thu, Sep 11, 2008 at 10:46, Eric Raible <raible@gmail.com> wrote:
> On Wed, Sep 10, 2008 at 7:12 PM, Changsheng Jiang <jiangzuoyan@gmail.com> wrote:
>> I think the current behavior is better than you described. If you want to
>> ignore some files, you can added it to the exclude file. All files not
>> excluded in the repo directory is maintained by git.
>
> That doesn't really address the problem.  This is an
> updated example that specifically ignores the file:
>
> # Create a single commit in a new repo (so that we have a HEAD)
> mkdir xx
> cd xx
> git init
> git commit --allow-empty -m"initial"
> # Add an important file
> echo "Important stuff" > file42
> git add file42
> echo file42 > .gitignore
> git status # -> new file:   file42
> ls # -> file42, or course
> git reset --hard
> ls # -> nothing
>
> So not only was file42 never actually tracked by git
> (IMHO - I realize that this is debatable) but it was also
> specifically ignored, and it is _still_ deleted w/out a trace!
>
> I realize that "git reset" will simply unstage the new file
> in either case (w or w/out .gitignore), but the consequences
> of an accidental "git reset --hard" are pretty severe in this
> case.  This behavior seems definitely contrary to Linus's
> explanation:
>
>   And "git reset" won't be deleting files it doesn't track (it had _better_
>   not touch them), even more so when it has been told to ignore them, so it
>   makes total sense to _not_ delete them when doing that reset.
>
> - Eric
>

  reply	other threads:[~2008-09-11  6:07 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-10 19:12 RFC: perhaps a "new file" should not be deleted by "git reset --hard" Eric Raible
     [not found] ` <eafc0afe0809101912v72916d3hce9ae5d6812f0db8@mail.gmail.com>
2008-09-11  2:14   ` Changsheng Jiang
2008-09-11  2:38     ` Elijah Newren
2008-09-11 20:50       ` Eric Raible
2008-09-11 21:34         ` Junio C Hamano
2008-09-11 22:19           ` Eric Raible
2008-09-11 23:04             ` Jeff Whiteside
2008-09-11 23:29               ` Eric Raible
2008-09-11  2:46   ` Eric Raible
2008-09-11  6:05     ` Changsheng Jiang [this message]
2008-09-11  6:15       ` RFC: perhaps a Eric Raible
2008-09-11 16:32       ` RFC: perhaps a "new file" should not be deleted by "git reset --hard" Elijah Newren
     [not found]         ` <3ab397d0809111022m24c81bd9y2520f6be478babd3@mail.gmail.com>
2008-09-11 21:24           ` Eric Raible
2008-09-11 23:39             ` Miklos Vajna
2008-09-11 23:49               ` Eric Raible
2008-09-12 15:41                 ` Miklos Vajna
2008-09-11  6:14 ` Mike Hommey
2008-09-11 20:26   ` Eric Raible

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=eafc0afe0809102305u6de85ef3ib2c08004dea8d6f9@mail.gmail.com \
    --to=jiangzuoyan@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=raible@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.