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

Re: git reset --hard not removing some files

From
Sean <seanlkml@sympatico.ca>
Date
Jun 1, 2006, 16:13 UTC
Message-ID
<BAYC1-PASMTP04B113F61282BAE465D7F0AE900@CEZ.ICE>
In-Reply-To
<20060601160052.GK14325@admingilde.org>

On Thu, 1 Jun 2006 18:00:52 +0200 Martin Waitz <tali@admingilde.org> wrote:

Removed your prompt just to make it a bit more readable:
Show 10 quoted lines
> $ git branch
> * master
>   next
>   origin
>
> $ git checkout -b test
>
> $ git status
> # On branch refs/heads/test
> nothing to commit

The generated files "git-quiltimport" and "git-upload-tar" exist at this point. They are both untracked files and aren't listed because they have entries in the .gitignore file.

Show 11 quoted lines
> $ git reset --hard v1.3.3
>
> $ git status
> # On branch refs/heads/test
> #
> # Untracked files:
> #   (use "git add" to add to commit)
> #
> #       git-quiltimport
> #       git-upload-tar
> nothing to commit

Resetting to version 1.3.3 gets you an old version of the .gitignore file which doesn't ignore these two untracked files. Reset --hard doesn't remove them because it only deals with tracked files. Thus, they show up in your status report.

> $ git reset --hard master
> $ git status
> # On branch refs/heads/test
> nothing to commit

Returning to the current version gets you an updated .gitignore and the two files are no longer listed even though they still exist.

> $ git --version
> git version 1.3.3.g0825d
This is the expected behavior regardless of version.
Sean
Previous: Martin WaitzNext: Jakub Narebski
Message 2 of 14 in “git reset --hard not removing some files”
  1. Martin WaitzJun 1, 2006
  2. SeanJun 1, 2006
  3. Jakub NarebskiJun 1, 2006
  4. SeanJun 1, 2006
  5. Jakub NarebskiJun 2, 2006
  6. Linus TorvaldsJun 1, 2006
  7. Martin WaitzJun 2, 2006
  8. SeanJun 2, 2006
  9. Junio C HamanoJun 2, 2006
  10. Junio C HamanoJun 3, 2006
  11. Linus TorvaldsJun 3, 2006
  12. Martin WaitzJun 4, 2006
  13. Junio C HamanoJun 4, 2006
  14. Martin WaitzJun 2, 2006

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.