git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: RFC: perhaps a "new file" should not be deleted by "git reset --hard"

From
EREric Raible <raible@gmail.com>
Date
Sep 11, 2008, 21:24 UTC
Message-ID
<279b37b20809111424y73a3f6b9xe7f5019b9ba0da16@mail.gmail.com>
In-Reply-To
<3ab397d0809111022m24c81bd9y2520f6be478babd3@mail.gmail.com>

On Thu, Sep 11, 2008 at 10:22 AM, Jeff Whiteside <jeff.m.whiteside@gmail.com> wrote:

> And if you want to delete all untracked files
>      ls | sed s/`git status --index --filenamesonly`//g | rm
>      ls | sed s/`git status --commitrepo --filenamesonly`//g | rm
>            (I realize those commands don't actually work, but I'm a noob.)

"git clean" (http://www.kernel.org/pub/software/scm/git/docs/git-clean.html) will delete untracked file.

> So that 'tracked by git' isn't just another ambiguous semantic.

While I can't find where it might be explicitly defined, it does seem clear that a file/dir is "tracked" as soon as it's added.

My question is why "git reset --hard" can't make a special case for _newly added_ tracked files. After all, "git status" knows that they're "new files", and "git reset --hard" could realize that wiping them off the face of the earth isn't the most helpful thing possible.

- Eric
Previous: Elijah NewrenNext: Miklos Vajna
Message 15 of 18 in “RFC: perhaps a "new file" should not be deleted by "git reset --hard"”
  1. Eric RaibleSep 10, 2008
  2. Mike HommeySep 11, 2008
  3. Eric RaibleSep 11, 2008
  4. Changsheng JiangSep 11, 2008
  5. Elijah NewrenSep 11, 2008
  6. Eric RaibleSep 11, 2008
  7. Junio C HamanoSep 11, 2008
  8. Eric RaibleSep 11, 2008
  9. Jeff WhitesideSep 11, 2008
  10. Eric RaibleSep 11, 2008
  11. Eric RaibleSep 11, 2008
  12. Changsheng JiangSep 11, 2008
  13. Eric RaibleSep 11, 2008
  14. Elijah NewrenSep 11, 2008
  15. Eric RaibleSep 11, 2008
  16. Miklos VajnaSep 11, 2008
  17. Eric RaibleSep 11, 2008
  18. Miklos VajnaSep 12, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.